org.apache.shiro.mgt.RememberMeManager Java Examples
The following examples show how to use
org.apache.shiro.mgt.RememberMeManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoreModule.java From onedev with MIT License | 6 votes |
private void configureSecurity() { contributeFromPackage(Realm.class, AbstractAuthorizingRealm.class); bind(RememberMeManager.class).to(OneRememberMeManager.class); bind(WebSecurityManager.class).to(OneWebSecurityManager.class); bind(FilterChainResolver.class).to(OneFilterChainResolver.class); bind(BasicAuthenticationFilter.class); bind(BearerAuthenticationFilter.class); bind(PasswordService.class).to(OnePasswordService.class); bind(ShiroFilter.class); install(new ShiroAopModule()); contribute(FilterChainConfigurator.class, new FilterChainConfigurator() { @Override public void configure(FilterChainManager filterChainManager) { filterChainManager.createChain("/**/info/refs", "noSessionCreation, authcBasic, authcBearer"); filterChainManager.createChain("/**/git-upload-pack", "noSessionCreation, authcBasic, authcBearer"); filterChainManager.createChain("/**/git-receive-pack", "noSessionCreation, authcBasic, authcBearer"); } }); contributeFromPackage(Authenticator.class, Authenticator.class); }
Example #2
Source File: ShiroAutoConfiguration.java From spring-boot-shiro with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnMissingBean(RememberMeManager.class) public RememberMeManager rememberMeManager(Cookie cookie) { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(cookie); cookieRememberMeManager.setCipherService(cipherService); if (shiroCookieProperties.getCipherKey() != null) { cookieRememberMeManager.setCipherKey(shiroCookieProperties.getCipherKey().getBytes()); } else { if (shiroCookieProperties.getEncryptionCipherKey() != null) { cookieRememberMeManager.setEncryptionCipherKey(shiroCookieProperties.getEncryptionCipherKey().getBytes()); } if (shiroCookieProperties.getDecryptionCipherKey() != null) { cookieRememberMeManager.setDecryptionCipherKey(shiroCookieProperties.getDecryptionCipherKey().getBytes()); } } cookieRememberMeManager.setSerializer(serializer); return cookieRememberMeManager; }
Example #3
Source File: ShiroAutoConfiguration.java From utils with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnMissingBean(RememberMeManager.class) public RememberMeManager rememberMeManager(Cookie cookie) { CookieRememberMeManager manager = new CookieRememberMeManager(); manager.setCookie(cookie); manager.setCipherService(cipherService); if (null != shiroCookieProperties.getCipherKey()) { manager.setCipherKey(shiroCookieProperties.getCipherKey().getBytes()); } else { if (null != shiroCookieProperties.getEncryptionCipherKey()) { manager.setEncryptionCipherKey(shiroCookieProperties.getEncryptionCipherKey().getBytes()); } if (null != shiroCookieProperties.getDecryptionCipherKey()) { manager.setDecryptionCipherKey(shiroCookieProperties.getDecryptionCipherKey().getBytes()); } } manager.setSerializer(serializer); return manager; }
Example #4
Source File: ShiroConfiguration.java From spring-boot-shiro with Apache License 2.0 | 5 votes |
@Bean(name = "securityManager") @DependsOn(value = {"cacheManager", "rememberMeManager", "mainRealm"}) public DefaultSecurityManager securityManager(Realm realm, RememberMeManager rememberMeManager, CacheManager cacheManager, SessionManager sessionManager) { DefaultSecurityManager sm = new DefaultWebSecurityManager(); sm.setRealm(realm); sm.setCacheManager(cacheManager); sm.setSessionManager(sessionManager); sm.setRememberMeManager(rememberMeManager); return sm; }
Example #5
Source File: ShiroConfiguration.java From utils with Apache License 2.0 | 5 votes |
@Bean(name = "securityManager") @DependsOn(value = {"cacheManager", "rememberMeManager", "mainRealm"}) public DefaultSecurityManager securityManager(Realm realm, RememberMeManager rememberMeManager, CacheManager cacheManager, SessionManager sessionManager) { DefaultSecurityManager sm = new DefaultWebSecurityManager(); sm.setRealm(realm); sm.setCacheManager(cacheManager); sm.setSessionManager(sessionManager); sm.setRememberMeManager(rememberMeManager); return sm; }
Example #6
Source File: TapestryRealmSecurityManager.java From tapestry-security with Apache License 2.0 | 5 votes |
public TapestryRealmSecurityManager(Authenticator authenticator, SubjectFactory subjectFactory, RememberMeManager rememberMeManager, final Collection<Realm> realms) { super(); authenticator.setRealms(realms); setAuthenticator(authenticator); ((DefaultSubjectDAO) this.subjectDAO).setSessionStorageEvaluator(new DefaultWebSessionStorageEvaluator()); setSubjectFactory(subjectFactory); setRememberMeManager(rememberMeManager); setSessionManager(new ServletContainerSessionManager()); setRealms(realms); }
Example #7
Source File: SecurityModule.java From tapestry-security with Apache License 2.0 | 5 votes |
@SuppressWarnings({"rawtypes", "unchecked"}) public static RememberMeManager buildRememberMeManager(Serializer serializer, Logger logger, @Symbol(SymbolConstants.HMAC_PASSPHRASE) String hmacPassphrase, @Symbol(SecuritySymbols.REMEMBERME_CIPHERKERY) String rememberMeCipherKey) throws UnsupportedEncodingException { CookieRememberMeManager rememberMeManager = new CookieRememberMeManager(); // the default Shiro serializer produces obnoxiously long cookies rememberMeManager.setSerializer(serializer); // assume properly configured cipher is of the right width (divisable by 16) byte[] cipherKey = Base64.decode(rememberMeCipherKey); if (cipherKey.length <= 0) { if (hmacPassphrase.isEmpty()) { logger .error("Neither symbol '" + SecuritySymbols.REMEMBERME_CIPHERKERY + "' nor '" + SymbolConstants.HMAC_PASSPHRASE + "' is set. Using a random value as the cipher key for encrypting rememberMe information. Cookies will be invalidated when the JVM is restarted"); return rememberMeManager; } logger.warn("Symbol '" + SecuritySymbols.REMEMBERME_CIPHERKERY + "' is not set, using '" + SymbolConstants.HMAC_PASSPHRASE + "' as the cipher. Beware that changing the value will invalidate rememberMe cookies"); if (hmacPassphrase.length() < 16) hmacPassphrase = hmacPassphrase + ("================".substring(hmacPassphrase.length())); cipherKey = hmacPassphrase.getBytes("UTF-8"); if (cipherKey.length > 16) cipherKey = Arrays.copyOf(cipherKey, 16); } rememberMeManager.setCipherKey(cipherKey); return rememberMeManager; }
Example #8
Source File: ShiroConfig.java From jsets-shiro-spring-boot-starter with Apache License 2.0 | 4 votes |
public RememberMeManager getRememberMeManager() { return this.rememberMeManager; }