Reputation: 1263
I have problem with j_spring_security_switch_user
, as I only can switch between users with the role ROLE_SWITCH_USER
.
Can I change it so it can switch to users with the ROLE_USER
from a user with the role ROLE_SWITCH_USER
?
Upvotes: 0
Views: 472
Reputation: 1263
I got it fixed by:
Create file MySwichUserFilter.groovy:
class MySwichUserFilter extends SwitchUserFilter {
protected Authentication attemptSwitchUser(HttpServletRequest request) throws AuthenticationException {
Authentication switchTo = super.attemptSwitchUser(request);
SecurityContextHolder.getContext().getAuthentication();
return switchTo;
}
}
Correct the resources.groovy
beans = {
...
switchUserProcessingFilter(MySwichUserFilter){
userDetailsService = ref('userDetailsService')
switchUserUrl = "/j_spring_security_switch_user"
exitUserUrl = "/j_spring_security_exit_user"
targetUrl = conf.successHandler.defaultTargetUrl
}
...
}
Upvotes: 1