org.apache.shiro.web.mgt.CookieRememberMeManager Java Examples
The following examples show how to use
org.apache.shiro.web.mgt.CookieRememberMeManager.
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: 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 #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: ShiroConfig.java From SpringBoot-Base-System with GNU Lesser General Public License v3.0 | 5 votes |
/** * cookie管理对象 */ @Bean @ConditionalOnMissingBean public CookieRememberMeManager rememberMeManager() { log.info("ShiroConfiguration.rememberMeManager()"); CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); return cookieRememberMeManager; }
Example #4
Source File: ShiroConfig.java From EasyReport with Apache License 2.0 | 5 votes |
@Bean public CookieRememberMeManager rememberMeManager() { final CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCipherKey(Base64.decode("ZUdsaGJuSmxibVI2ZHc9PQ==")); cookieRememberMeManager.setCookie(rememberMeCookie()); return cookieRememberMeManager; }
Example #5
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 #6
Source File: ShiroConfig.java From pybbs with GNU Affero General Public License v3.0 | 5 votes |
@Bean @DependsOn("mybatisPlusConfig") public CookieRememberMeManager rememberMeManager() { //System.out.println("ShiroConfiguration.rememberMeManager()"); CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); //rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) cookieRememberMeManager.setCipherKey(Base64.encode("pybbs is the best!".getBytes())); return cookieRememberMeManager; }
Example #7
Source File: ShiroConfig.java From ElementVueSpringbootCodeTemplate with Apache License 2.0 | 5 votes |
/** * 记住我管理器 cookie管理对象; * * @return */ @Bean(name = "cookieRememberMeManager") public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); return cookieRememberMeManager; }
Example #8
Source File: ShiroConfiguration.java From wangmarket with Apache License 2.0 | 5 votes |
/** * cookie管理对象;记住我功能 * @return */ public CookieRememberMeManager rememberMeManager(){ CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); //rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) // cookieRememberMeManager.setCipherKey(Base64.decode("3AvVhmFLUs0KTA3Kprsdag==")); return cookieRememberMeManager; }
Example #9
Source File: ShiroConfig.java From yyblog with MIT License | 5 votes |
/** * cookie管理器; * @return */ @Bean public CookieRememberMeManager rememberMeManager(){ CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); //rememberme cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位),通过以下代码可以获取 //KeyGenerator keygen = KeyGenerator.getInstance("AES"); //SecretKey deskey = keygen.generateKey(); //System.out.println(Base64.encodeToString(deskey.getEncoded())); byte[] cipherKey = Base64.decode("wGiHplamyXlVB11UXWol8g=="); cookieRememberMeManager.setCipherKey(cipherKey); cookieRememberMeManager.setCookie(rememberMeCookie()); return cookieRememberMeManager; }
Example #10
Source File: ShiroConfig.java From SpringAll with MIT License | 5 votes |
/** * cookie管理对象 * @return */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); // rememberMe cookie加密的密钥 cookieRememberMeManager.setCipherKey(Base64.decode("3AvVhmFLUs0KTA3Kprsdag==")); return cookieRememberMeManager; }
Example #11
Source File: ShiroConfig.java From OneBlog with GNU General Public License v3.0 | 5 votes |
/** * cookie管理对象;记住我功能 * * @return */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); //rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) cookieRememberMeManager.setCipherKey(Base64.decode("1QWLxg+NYmxraMoxAXu/Iw==")); return cookieRememberMeManager; }
Example #12
Source File: ShiroConfig.java From LuckyFrameWeb with GNU Affero General Public License v3.0 | 5 votes |
/** * 记住我 */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("fCq+/xW488hMTCD+cmJ3aQ==")); return cookieRememberMeManager; }
Example #13
Source File: ShiroConfig.java From DouBiNovel with Apache License 2.0 | 5 votes |
/** * cookie管理对象;记住我功能,rememberMe管理器 * @return */ @Bean public CookieRememberMeManager rememberMeManager(){ CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); //rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) cookieRememberMeManager.setCipherKey(Base64.decode("4AvVhmFLUs0KTA3Kprsdag==")); return cookieRememberMeManager; }
Example #14
Source File: ShiroConfig.java From RuoYi with Apache License 2.0 | 5 votes |
/** * 记住我 */ private CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("fCq+/xW488hMTCD+cmJ3aQ==")); return cookieRememberMeManager; }
Example #15
Source File: ShiroConfig.java From SpringBootBucket with MIT License | 5 votes |
/** * cookie管理对象; * * @return */ @Bean public CookieRememberMeManager rememberMeManager() { //System.out.println("ShiroConfiguration.rememberMeManager()"); CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); return cookieRememberMeManager; }
Example #16
Source File: ShiroConfig.java From springboot-shiro with MIT License | 5 votes |
/** * cookie管理对象;记住我功能 * * @return */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); //rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) cookieRememberMeManager.setCipherKey(Base64.decode("1QWLxg+NYmxraMoxAXu/Iw==")); return cookieRememberMeManager; }
Example #17
Source File: ShiroConfig.java From supplierShop with MIT License | 5 votes |
/** * 记住我 */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("fCq+/xW488hMTCD+cmJ3aQ==")); return cookieRememberMeManager; }
Example #18
Source File: ShiroConfig.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * cookie 管理器 * @return */ @Bean(name="cookieRememberMeManager") @DependsOn({"simpleCookie"}) public CookieRememberMeManager getCookieRememberMeManager(SimpleCookie simpleCookie){ CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(simpleCookie); /** * 设置 rememberMe cookie 的密钥 ,不设置 很可能:javax.crypto.BadPaddingException: Given final block not properly padded */ cookieRememberMeManager.setCipherKey(Base64.decode("2AvVhdsgUs0FSA3SDFAdag==")); return cookieRememberMeManager ; }
Example #19
Source File: ShiroConfig.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * @DependOn :在初始化 defaultWebSecurityManager 实例前 强制先初始化 adminRealm ,ehCacheManager。。。。。 * @param realm * @param ehCacheManager * @param cookieRememberMeManager * @return */ @Bean(name = "securityManager") @DependsOn({"adminRealm","ehCacheManager","cookieRememberMeManager"}) public DefaultWebSecurityManager getDefaultWebSecurityManager(AdminRealm realm, EhCacheManager ehCacheManager,CookieRememberMeManager cookieRememberMeManager) { DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager(); //设置realm. defaultWebSecurityManager.setRealm(realm); defaultWebSecurityManager.setCacheManager(ehCacheManager); defaultWebSecurityManager.setRememberMeManager(cookieRememberMeManager); return defaultWebSecurityManager; }
Example #20
Source File: ShiroConfig.java From MeetingFilm with Apache License 2.0 | 5 votes |
/** * rememberMe管理器, cipherKey生成见{@code Base64Test.java} */ @Bean public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) { CookieRememberMeManager manager = new CookieRememberMeManager(); manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA==")); manager.setCookie(rememberMeCookie); return manager; }
Example #21
Source File: ShiroConfig.java From ruoyiplus with MIT License | 5 votes |
/** * 记住我 */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("fCq+/xW488hMTCD+cmJ3aQ==")); return cookieRememberMeManager; }
Example #22
Source File: AuthConfig.java From v-mock with MIT License | 5 votes |
/** * 记住我 */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("fCq+/xW488hMTCD+cmJ3aQ==")); return cookieRememberMeManager; }
Example #23
Source File: ShiroConfig.java From WebStack-Guns with MIT License | 5 votes |
/** * rememberMe管理器, cipherKey生成见{@code Base64Test.java} */ @Bean public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) { CookieRememberMeManager manager = new CookieRememberMeManager(); manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA==")); manager.setCookie(rememberMeCookie); return manager; }
Example #24
Source File: ShiroConfig.java From kvf-admin with MIT License | 5 votes |
/** * cookie管理对象; * @return cookieRememberMeManager */ private CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); // rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) cookieRememberMeManager.setCipherKey(Base64.decode("2AvVhdsgUs0FSA3SDFAdag==")); return cookieRememberMeManager; }
Example #25
Source File: ShiroConfig.java From springboot-learn with MIT License | 5 votes |
/** * 记住我 */ public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("fCq+/xW488hMTCD+cmJ3aQ==")); return cookieRememberMeManager; }
Example #26
Source File: ShiroConfig.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * cookie 管理器 * @return */ @Bean(name="cookieRememberMeManager") @DependsOn({"simpleCookie"}) public CookieRememberMeManager getCookieRememberMeManager(SimpleCookie simpleCookie){ CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(simpleCookie); /** * 设置 rememberMe cookie 的密钥 ,不设置 很可能:javax.crypto.BadPaddingException: Given final block not properly padded */ cookieRememberMeManager.setCipherKey(Base64.decode("2AvVhdsgUs0FSA3SDFAdag==")); return cookieRememberMeManager ; }
Example #27
Source File: ShiroConfig.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * @DependOn :在初始化 defaultWebSecurityManager 实例前 强制先初始化 adminRealm ,ehCacheManager。。。。。 * @param realm * @param ehCacheManager * @param cookieRememberMeManager * @return */ @Bean(name = "securityManager") @DependsOn({"adminRealm","ehCacheManager","cookieRememberMeManager"}) public DefaultWebSecurityManager getDefaultWebSecurityManager(AdminRealm realm, EhCacheManager ehCacheManager,CookieRememberMeManager cookieRememberMeManager) { DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager(); //设置realm. defaultWebSecurityManager.setRealm(realm); defaultWebSecurityManager.setCacheManager(ehCacheManager); defaultWebSecurityManager.setRememberMeManager(cookieRememberMeManager); return defaultWebSecurityManager; }
Example #28
Source File: ShiroConfiguration.java From spring-boot-seed with MIT License | 5 votes |
/** * RememberMeManager: remenberMe的管理器,注入有Cookie * * @return CookieRememberMeManager */ @Bean public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); return cookieRememberMeManager; }
Example #29
Source File: ShiroConfig.java From SpringAll with MIT License | 4 votes |
public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("4AvVhmFLUs0KTA3Kprsdag==")); return cookieRememberMeManager; }
Example #30
Source File: ShiroConfig.java From SpringAll with MIT License | 4 votes |
public CookieRememberMeManager rememberMeManager() { CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCipherKey(Base64.decode("4AvVhmFLUs0KTA3Kprsdag==")); return cookieRememberMeManager; }