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:56 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.1.x-fixes 612dd077d -> 743bad8b1


[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/743bad8b
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/743bad8b
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/743bad8b

Branch: refs/heads/1.1.x-fixes
Commit: 743bad8b146796ff562119a904e765358af3c4c7
Parents: 612dd07
Author: Jan Bernhardt <jbernhardt@talend.com>
Authored: Wed Mar 11 11:10:07 2015 +0100
Committer: Jan Bernhardt <jbernhardt@talend.com>
Committed: Wed Mar 11 11:10:07 2015 +0100

----------------------------------------------------------------------
 .gitignore                                         |  1 +
 .../fediz/service/sts/realms/UriRealmParser.java   | 17 ++++++++++++-----
 .../sts/src/main/webapp/WEB-INF/cxf-transport.xml  |  6 +++---
 3 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/743bad8b/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index f5f8e88..216671a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,4 +12,5 @@
 target/
 velocity.log
 .externalToolBuilders/
+.idea
 

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/743bad8b/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/743bad8b/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 3efe74d..4fe2261 100644
--- a/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
+++ b/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
@@ -137,9 +137,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">
 	    <property name="samlRealmCodec" ref="samlRealmCodec" />


Mime
View raw message