|
@@ -16,11 +16,12 @@ import java.util.Map;
|
|
|
public class ShiroConfiguration {
|
|
|
|
|
|
//Filter工厂,设置对应的过滤条件和跳转条件
|
|
|
- @Bean(name="shiroFilter")
|
|
|
+ @Bean(name = "shiroFilter")
|
|
|
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
|
|
|
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
|
|
|
shiroFilterFactoryBean.setSecurityManager(securityManager);
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("jwt", new JWTFilter());
|
|
|
//登出
|
|
|
map.put("/logout", "logout");
|
|
|
//对所有用户认证
|
|
@@ -36,7 +37,7 @@ public class ShiroConfiguration {
|
|
|
}
|
|
|
|
|
|
//配置核心安全事务管理器
|
|
|
- @Bean(name="securityManager")
|
|
|
+ @Bean(name = "securityManager")
|
|
|
public SecurityManager securityManager() {
|
|
|
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
|
|
|
securityManager.setRealm(systemAuthorizingRealm());
|
|
@@ -44,7 +45,7 @@ public class ShiroConfiguration {
|
|
|
}
|
|
|
|
|
|
//将自己的验证方式加入容器
|
|
|
- @Bean(name="systemAuthorizingRealm")
|
|
|
+ @Bean(name = "systemAuthorizingRealm")
|
|
|
public SystemAuthorizingRealm systemAuthorizingRealm() {
|
|
|
SystemAuthorizingRealm systemAuthorizingRealm = new SystemAuthorizingRealm();
|
|
|
systemAuthorizingRealm.setCredentialsMatcher(hashedCredentialsMatcher());
|
|
@@ -52,7 +53,7 @@ public class ShiroConfiguration {
|
|
|
}
|
|
|
|
|
|
@Bean
|
|
|
- public HashedCredentialsMatcher hashedCredentialsMatcher(){
|
|
|
+ public HashedCredentialsMatcher hashedCredentialsMatcher() {
|
|
|
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher("SHA-1");
|
|
|
matcher.setHashIterations(1024);
|
|
|
return matcher;
|
|
@@ -60,7 +61,7 @@ public class ShiroConfiguration {
|
|
|
|
|
|
// AOP式方法级权限检查
|
|
|
@Bean
|
|
|
- public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator(){
|
|
|
+ public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
|
|
|
DefaultAdvisorAutoProxyCreator creator = new DefaultAdvisorAutoProxyCreator();
|
|
|
creator.setProxyTargetClass(true);
|
|
|
return creator;
|