¡@

Home 

java Programming Glossary: securitycontext

When using Spring Security, what is the proper way to obtain current username (i.e. SecurityContext) information in a bean?

http://stackoverflow.com/questions/248562/when-using-spring-security-what-is-the-proper-way-to-obtain-current-username-i

what is the proper way to obtain current username i.e. SecurityContext information in a bean I have a Spring MVC web app which uses.. Is there a way to configure the app to have the current SecurityContext or current Authentication injected instead @RequestMapping method.. HttpServletRequest request... final String currentUser SecurityContextHolder.getContext .getAuthentication .getName ... java spring..

Unit testing with Spring Security

http://stackoverflow.com/questions/360520/unit-testing-with-spring-security

info from anywhere in your app... Object principal SecurityContextHolder.getContext .getAuthentication .getPrincipal ... which.. accepted way to inject an Authentication object into the SecurityContext so that it is available for my unit tests when the unit tests.. each test case protected void setUp throws Exception ... SecurityContextHolder.getContext .setAuthentication new UsernamePasswordAuthenticationToken..

How to manually set an authenticated user in Spring Security / SpringMVC

http://stackoverflow.com/questions/4664893/how-to-manually-set-an-authenticated-user-in-spring-security-springmvc

UsernamePasswordAuthenticationToken and setting it in the SecurityContext manually SecurityContextHolder.getContext .setAuthentication.. and setting it in the SecurityContext manually SecurityContextHolder.getContext .setAuthentication authentication On that same.. same page I later check that the user is logged in with SecurityContextHolder.getContext .getAuthentication .getAuthorities This returns..

Spring security's SecurityContextHolder: session or request bound?

http://stackoverflow.com/questions/6408007/spring-securitys-securitycontextholder-session-or-request-bound

security's SecurityContextHolder session or request bound Is the Userprincipal I retrieve.. or request bound Is the Userprincipal I retrieve from SecurityContextHolder bound to requests or to sessions UserPrincipal principal.. or to sessions UserPrincipal principal UserPrincipal SecurityContextHolder.getContext .getAuthentication .getPrincipal This is the..