You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/03/16 06:11:20 UTC
[incubator-inlong] branch master updated: [INLONG-3156] add getAuthorizationAttributeSourceAdvisor() from InlongShiro interface (#3157)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 9406385 [INLONG-3156] add getAuthorizationAttributeSourceAdvisor() from InlongShiro interface (#3157)
9406385 is described below
commit 9406385fded8a1a6d27893a961093dfc7419e0d2
Author: wardli <95...@users.noreply.github.com>
AuthorDate: Wed Mar 16 14:11:15 2022 +0800
[INLONG-3156] add getAuthorizationAttributeSourceAdvisor() from InlongShiro interface (#3157)
---
.../java/org/apache/inlong/manager/common/auth/InlongShiro.java | 3 +++
.../java/org/apache/inlong/manager/web/auth/ShiroConfig.java | 4 +---
.../org/apache/inlong/manager/web/auth/impl/InlongShiroImpl.java | 9 +++++++++
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/auth/InlongShiro.java b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/auth/InlongShiro.java
index bd71dd9..b6fb3e5 100644
--- a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/auth/InlongShiro.java
+++ b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/auth/InlongShiro.java
@@ -20,6 +20,7 @@ package org.apache.inlong.manager.common.auth;
import org.apache.shiro.authc.credential.CredentialsMatcher;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.WebSecurityManager;
import org.apache.shiro.web.session.mgt.WebSessionManager;
@@ -35,4 +36,6 @@ public interface InlongShiro {
CredentialsMatcher getCredentialsMatcher();
ShiroFilterFactoryBean getShiroFilter(SecurityManager securityManager);
+
+ AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(SecurityManager securityManager);
}
diff --git a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/ShiroConfig.java b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/ShiroConfig.java
index aabb6a9..165efff 100644
--- a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/ShiroConfig.java
+++ b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/ShiroConfig.java
@@ -80,8 +80,6 @@ public class ShiroConfig {
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() {
- AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
- advisor.setSecurityManager(securityManager(hashedCredentialsMatcher()));
- return advisor;
+ return inLongShiro.getAuthorizationAttributeSourceAdvisor(securityManager(hashedCredentialsMatcher()));
}
}
diff --git a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/impl/InlongShiroImpl.java b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/impl/InlongShiroImpl.java
index 48c7d0c..44c938a 100644
--- a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/impl/InlongShiroImpl.java
+++ b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/auth/impl/InlongShiroImpl.java
@@ -28,6 +28,7 @@ import org.apache.shiro.authc.credential.CredentialsMatcher;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.mgt.WebSecurityManager;
@@ -94,4 +95,12 @@ public class InlongShiroImpl implements InlongShiro {
shiroFilterFactoryBean.setFilterChainDefinitionMap(pathDefinitions);
return shiroFilterFactoryBean;
}
+
+ @Override
+ public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(SecurityManager securityManager) {
+ AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor =
+ new AuthorizationAttributeSourceAdvisor();
+ authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
+ return authorizationAttributeSourceAdvisor;
+ }
}