log.debug("Logging out subject with primary principal {}", principals.getPrimaryPrincipal()); Authenticator authc = getAuthenticator(); if (authc instanceof LogoutAware) { ((LogoutAware) authc).onLogout(principals);
OrderedAuthenticatingRealms orderedAuthenticatingRealms) { sm = new DefaultSecurityManager(orderedAuthenticatingRealms); final Authenticator authenticator = sm.getAuthenticator(); if (authenticator instanceof ModularRealmAuthenticator) { ((ModularRealmAuthenticator) authenticator).setAuthenticationStrategy(new FirstSuccessfulStrategy());
log.debug("Logging out subject with primary principal {}", principals.getPrimaryPrincipal()); Authenticator authc = getAuthenticator(); if (authc instanceof LogoutAware) { ((LogoutAware) authc).onLogout(principals);
protected static void seupAuthenticationStrategy() { Set<AuthenticationStrategy> authenticators = getServices(AuthenticationStrategy.class); if (authenticators.size() > 0) { ModularRealmAuthenticator mod = new ModularRealmAuthenticator(); Authenticator auth = securityManager.getAuthenticator(); if (auth instanceof ModularRealmAuthenticator) { mod = (ModularRealmAuthenticator) auth; } else { securityManager.setAuthenticator(mod); } Iterator<AuthenticationStrategy> it = authenticators.iterator(); AuthenticationStrategy strategy = it.next(); mod.setAuthenticationStrategy(strategy); if (it.hasNext()) { log.warn(String.format("Multiple authentication strategies found, only using the first one which is" + " %s ", strategy.getClass().getName())); } } else { log.info("No authentication service setup on the class path"); } }
@Provides @Singleton SecurityManager provideSecurityManager( SessionManager sessionManager, RememberMeManager rememberMeManager, Realms realms, Set<AuthenticationListener> authListeners) { DefaultSecurityManager manager = new DefaultSecurityManager(realms.getRealms()); ((AbstractAuthenticator) manager.getAuthenticator()).setAuthenticationListeners(authListeners); manager.setSessionManager(sessionManager); manager.setRememberMeManager(rememberMeManager); return manager; }
log.debug("Logging out subject with primary principal {}" + principals.getPrimaryPrincipal()); Authenticator authc = getAuthenticator(); if (authc instanceof LogoutAware) { ((LogoutAware) authc).onLogout(principals);
MultiRealmAuthManager( EnterpriseUserManager userManager, Collection<Realm> realms, CacheManager cacheManager, SecurityLog securityLog, boolean logSuccessfulLogin, boolean propertyAuthorization, Map<String,List<String>> roleToPropertyBlacklist ) { this.userManager = userManager; this.realms = realms; this.cacheManager = cacheManager; securityManager = new DefaultSecurityManager( realms ); this.securityLog = securityLog; this.logSuccessfulLogin = logSuccessfulLogin; this.propertyAuthorization = propertyAuthorization; this.roleToPropertyBlacklist = roleToPropertyBlacklist; securityManager.setSubjectFactory( new ShiroSubjectFactory() ); ((ModularRealmAuthenticator) securityManager.getAuthenticator()) .setAuthenticationStrategy( new ShiroAuthenticationStrategy() ); securityManager.setSubjectDAO( createSubjectDAO() ); }
OrderedAuthenticatingRealms orderedAuthenticatingRealms) { sm = new DefaultSecurityManager(orderedAuthenticatingRealms); final Authenticator authenticator = sm.getAuthenticator(); if (authenticator instanceof ModularRealmAuthenticator) { ((ModularRealmAuthenticator) authenticator).setAuthenticationStrategy(new FirstSuccessfulStrategy());