cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbernha...@apache.org
Subject cxf-fediz git commit: [FEDIZ-98] Dynamic STS Realm Parser
Date Wed, 11 Mar 2015 10:37:14 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master b409d4755 -> 7eb8875cb


[FEDIZ-98] Dynamic STS Realm Parser


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/7eb8875c
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/7eb8875c
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/7eb8875c

Branch: refs/heads/master
Commit: 7eb8875cb4dc0183c4a02d6ebd67cb4ead70ec64
Parents: b409d47
Author: Jan Bernhardt <jbernhardt@talend.com>
Authored: Wed Mar 11 11:18:52 2015 +0100
Committer: Jan Bernhardt <jbernhardt@talend.com>
Committed: Wed Mar 11 11:18:52 2015 +0100

----------------------------------------------------------------------
 .../fediz/service/sts/realms/UriRealmParser.java   | 17 ++++++++++++-----
 .../sts/src/main/webapp/WEB-INF/cxf-transport.xml  |  5 +++--
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7eb8875c/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
----------------------------------------------------------------------
diff --git a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
index e6caa65..1efe4b6 100644
--- a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
+++ b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.fediz.service.sts.realms;
 
+import java.util.Map;
 import java.util.StringTokenizer;
 
 import javax.xml.ws.WebServiceContext;
@@ -30,10 +31,10 @@ import org.slf4j.LoggerFactory;
 
 public class UriRealmParser implements RealmParser {
 
-    public enum REALMS { REALMA, REALMB };
-
     private static final Logger LOG = LoggerFactory.getLogger(UriRealmParser.class);
 
+    private Map<String, Object> realmMap;
+
     @Override
     public String parseRealm(WebServiceContext context) throws STSException {
         String url = (String)context.getMessageContext().get("org.apache.cxf.request.url");
@@ -52,13 +53,19 @@ public class UriRealmParser implements RealmParser {
             realm = st.nextToken();
         }
         realm = realm.toUpperCase();
-        try {
-            REALMS.valueOf(realm);
-        } catch (IllegalArgumentException ex) {
+        if (realmMap == null || !realmMap.containsKey(realm)) {
             LOG.warn("Unknown realm: " + realm);
             throw new STSException("Unknown realm: " + realm);
         }
         return realm;
     }
 
+    public Map<String, Object> getRealmMap() {
+        return realmMap;
+    }
+
+    public void setRealmMap(Map<String, Object> realms) {
+        this.realmMap = realms;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7eb8875c/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
----------------------------------------------------------------------
diff --git a/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml b/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
index 1ddd388..d5dd55e 100644
--- a/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
+++ b/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
@@ -160,8 +160,9 @@
     <bean id="samlRealmCodec"
         class="org.apache.cxf.fediz.service.sts.realms.SamlRealmCodec" />
 
-    <bean id="customRealmParser"
-        class="org.apache.cxf.fediz.service.sts.realms.UriRealmParser" />
+    <bean id="customRealmParser" class="org.apache.cxf.fediz.service.sts.realms.UriRealmParser">
+		<property name="realmMap" ref="realms" />
+	</bean>
 
     <bean id="transportSamlTokenValidator"
         class="org.apache.cxf.sts.token.validator.SAMLTokenValidator">


Mime
View raw message