hello,
I have 'special url' allowed for IS_AUTHENTICATED_ANONYMOUSLY and scenario:
1. browser sends request to this url
2. in server logic I decide what authority will be work then and login it
3. browser gets page and user starts work with system as authority from 2.
my code is:
it works inside one request. when user tries to open some server urls from page he gets login page as unauthorized person.Code:private def loginUser(username) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken( userDetails, userDetails.getPassword(), userDetails.getAuthorities())); }


Reply With Quote
