Method method = webLogicSecurity.getMethod("getCurrentSubject", new Class[]{});
Subject wlsSubject = (Subject) method.invoke( null, new Object[]{ } );
if ( wlsSubject != null ) {
for ( java.security.Principal p : wlsSubject.getPrincipals() ) {
if (p.getClass().getName().indexOf("WLSGroup") != -1) {
roles.add( new RoleImpl( p.getName() ) );
}
}
}
} catch ( Exception e ) {
logger.error( "Unable to get groups from subject due to {}", e.getMessage(), e );
}
}
if ( mode.equals( RolesMode.ROLE ) || mode.equals( RolesMode.BOTH ) ) {
if ( securityContext instanceof HttpSecurityContext ) {
final HttpServletRequest request = ( (HttpSecurityContext) securityContext ).getRequest();
for ( final Role enforcementRole : RolesRegistry.get().getRegisteredRoles() ) {
if ( request.isUserInRole( enforcementRole.getName() ) ) {
roles.add( new RoleImpl( enforcementRole.getName() ) );
}
}
} else {
if ( roleProviderServices != null ) {
roles.addAll( roleProviderServices.getRoles() );