@Before public void setUp() { strategy = new FirstSuccessfulStrategy(); }
final Authenticator authenticator = sm.getAuthenticator(); if (authenticator instanceof ModularRealmAuthenticator) { ((ModularRealmAuthenticator) authenticator).setAuthenticationStrategy(new FirstSuccessfulStrategy());
@Bean public Authenticator authenticator(UserService userService) { ModularRealmAuthenticator authenticator = new ModularRealmAuthenticator(); authenticator.setRealms(Arrays.asList(jwtShiroRealm(userService), dbShiroRealm(userService))); authenticator.setAuthenticationStrategy(new FirstSuccessfulStrategy()); return authenticator; }
public void init() throws ShiroException { this.setSessionManager( new DefaultSessionManager() ); // This could be injected // Authorizer ExceptionCatchingModularRealmAuthorizer authorizer = new ExceptionCatchingModularRealmAuthorizer( this.getRealms() ); // if we have a Role Permission Resolver, set it, if not, don't worry about it if ( rolePermissionResolver != null ) { authorizer.setRolePermissionResolver( rolePermissionResolver ); logger.debug( "RolePermissionResolver was set to " + authorizer.getRolePermissionResolver() ); } else { logger.warn( "No RolePermissionResolver is set" ); } this.setAuthorizer( authorizer ); // set the realm authenticator, that will automatically deligate the authentication to all the realms. FirstSuccessfulModularRealmAuthenticator realmAuthenticator = new FirstSuccessfulModularRealmAuthenticator(); realmAuthenticator.setAuthenticationStrategy( new FirstSuccessfulStrategy() ); // Authenticator this.setAuthenticator( realmAuthenticator ); } }
final Authenticator authenticator = sm.getAuthenticator(); if (authenticator instanceof ModularRealmAuthenticator) { ((ModularRealmAuthenticator) authenticator).setAuthenticationStrategy(new FirstSuccessfulStrategy());