cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1570351 - in /cxf/fediz/trunk/services/idp/src: main/java/org/apache/cxf/fediz/service/idp/beans/ main/java/org/apache/cxf/fediz/service/idp/domain/ main/java/org/apache/cxf/fediz/service/idp/service/jpa/ test/java/org/apache/cxf/fediz/ser...
Date Thu, 20 Feb 2014 20:56:19 GMT
Author: owulff
Date: Thu Feb 20 20:56:19 2014
New Revision: 1570351

URL: http://svn.apache.org/r1570351
Log:
[FEDIZ-70] Missing support for Web Services Policy 1.2

Modified:
    cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java
    cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/Application.java
    cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java
    cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
    cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java
    cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java?rev=1570351&r1=1570350&r2=1570351&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java
(original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java
Thu Feb 20 20:56:19 2014
@@ -177,6 +177,11 @@ public class STSClientAction {
         } else {
             sts.setTokenType(getTokenType());
         }
+        
+        if (serviceConfig.getPolicyNamespace() != null && serviceConfig.getPolicyNamespace().length()
> 0) {
+            sts.setWspNamespace(serviceConfig.getPolicyNamespace());
+        }
+        
         if (LOG.isDebugEnabled()) {
             LOG.debug("TokenType " + sts.getTokenType() + " set for " + wtrealm);
         }

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/Application.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/Application.java?rev=1570351&r1=1570350&r2=1570351&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/Application.java
(original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/Application.java
Thu Feb 20 20:56:19 2014
@@ -31,7 +31,7 @@ import javax.xml.bind.annotation.XmlType
 
 @XmlRootElement(name = "application", namespace = "http://org.apache.cxf.fediz/")
 @XmlType(propOrder = {"realm", "role", "serviceDisplayName", "serviceDescription", "protocol",
-                      "tokenType", "lifeTime", "encryptionCertificate", "requestedClaims",
"id" })
+                      "tokenType", "lifeTime", "encryptionCertificate", "requestedClaims",
"policyNamespace", "id" })
 public class Application implements Serializable {
         
     private static final long serialVersionUID = 5644327504861846964L;
@@ -76,6 +76,9 @@ public class Application implements Seri
     // Not in Metadata, configured in IDP or passed in wreq parameter
     protected String lifeTime;
     
+    // WS-Policy Namespace for AppliesTo element
+    protected String policyNamespace;
+    
     private URI href;
     
     
@@ -170,6 +173,13 @@ public class Application implements Seri
     public void setLifeTime(String lifeTime) {
         this.lifeTime = lifeTime;
     }
-        
+
+    public String getPolicyNamespace() {
+        return policyNamespace;
+    }
+
+    public void setPolicyNamespace(String policyNamespace) {
+        this.policyNamespace = policyNamespace;
+    }
 
 }

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java?rev=1570351&r1=1570350&r2=1570351&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java
(original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPAImpl.java
Thu Feb 20 20:56:19 2014
@@ -204,6 +204,7 @@ public class ApplicationDAOJPAImpl imple
         entity.setServiceDescription(application.getServiceDescription());
         entity.setServiceDisplayName(application.getServiceDisplayName());
         entity.setTokenType(application.getTokenType());
+        entity.setPolicyNamespace(application.getPolicyNamespace());
     }
     
     public static Application entity2domain(ApplicationEntity entity, List<String>
expandList) {
@@ -217,6 +218,7 @@ public class ApplicationDAOJPAImpl imple
         application.setServiceDescription(entity.getServiceDescription());
         application.setServiceDisplayName(entity.getServiceDisplayName());
         application.setTokenType(entity.getTokenType());
+        application.setPolicyNamespace(entity.getPolicyNamespace());
         
         if (expandList != null && (expandList.contains("all") || expandList.contains("claims")))
{
             for (ApplicationClaimEntity item : entity.getRequestedClaims()) {

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java?rev=1570351&r1=1570350&r2=1570351&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
(original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
Thu Feb 20 20:56:19 2014
@@ -68,8 +68,11 @@ public class ApplicationEntity {
     
     // Not in Metadata, configured in IDP or passed in wreq parameter
     private String lifeTime;
+    
+    // WS-Policy Namespace in SignIn Response
+    private String policyNamespace;
 
-   
+    
     public int getId() {
         return id;
     }
@@ -149,5 +152,13 @@ public class ApplicationEntity {
     public void setLifeTime(String lifeTime) {
         this.lifeTime = lifeTime;
     }
+    
+    public String getPolicyNamespace() {
+        return policyNamespace;
+    }
+
+    public void setPolicyNamespace(String policyNamespace) {
+        this.policyNamespace = policyNamespace;
+    }
 
 }

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java?rev=1570351&r1=1570350&r2=1570351&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java
(original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderImpl.java
Thu Feb 20 20:56:19 2014
@@ -89,6 +89,7 @@ public class DBLoaderImpl implements DBL
             entity.setServiceDescription("Fedizhelloworld description");
             entity.setServiceDisplayName("Fedizhelloworld");
             entity.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0");
+            entity.setPolicyNamespace("http://www.w3.org/ns/ws-policy");
             // must be persistet here already as the ApplicationClaimEntity requires the
Application Id
             em.persist(entity);
             ApplicationClaimEntity ace1 = new ApplicationClaimEntity(entity, claimEntity1);
@@ -152,43 +153,6 @@ public class DBLoaderImpl implements DBL
             idpEntity.setUseCurrentIDP(true);
             em.persist(idpEntity);
             
-            /*
-            ClaimEntity claimEntity5 = new ClaimEntity();
-            claimEntity5.setClaimType("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/city");
-            claimEntity5.setDisplayName("city");
-            claimEntity5.setDescription("Description for city");
-            em.persist(claimEntity5);
-                        
-            ApplicationEntity entity2 = new ApplicationEntity();
-            entity2.setEncryptionCertificate("my encryption cert2");
-            entity2.setLifeTime("22my lifetime");
-            entity2.setProtocol("22protocol");
-            entity2.setRealm("myrealm2");
-            entity2.setRole("myrole");
-            entity2.setServiceDescription("service description2");
-            entity2.setServiceDisplayName("service displayname2");
-            entity2.setTokenType("my tokentype");
-            // must be persistet here already as the ApplicationClaimEntity requires the
Application Id
-            em.persist(entity2);
-            ApplicationClaimEntity ace5 = new ApplicationClaimEntity(entity2, claimEntity5);
-            ace5.setOptional(false);
-            em.persist(ace5);
-            entity2.getRequestedClaims().add(ace5);
-            em.persist(entity2);
-            
-            TrustedIdpEntity entity4 = new TrustedIdpEntity();
-            entity4.setCacheTokens(true);
-            entity4.setCertificate("trusted cert");
-            entity4.setDescription("Realm B description");
-            entity4.setFederationType("FederateIdentity");
-            entity4.setName("Realm B");
-            entity4.setProtocol("http://docs.oasis-open.org/wsfed/federation/200706");
-            entity4.setRealm("trustedidp2realm");
-            entity4.setTrustType("PEER_TRUST");
-            entity4.setUrl("https://localhost:${realmB.port}/fediz-idp-remote/federation");
-            em.persist(entity4);
-            */
-            
             em.flush();
         } catch (Exception ex) {
             LOG.warn("Failed to initialize DB with data", ex);

Modified: cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java?rev=1570351&r1=1570350&r2=1570351&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
(original)
+++ cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
Thu Feb 20 20:56:19 2014
@@ -89,7 +89,10 @@ public class ApplicationDAOJPATest {
                       "ServiceDisplayName doesn't match");
         Assert.isTrue("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
                       .equals(application.getTokenType()),
-                      "TokenType doesn't match");         
+                      "TokenType doesn't match");
+        Assert.isTrue("http://www.w3.org/ns/ws-policy"
+                      .equals(application.getPolicyNamespace()),
+                      "Policy Namespace doesn't match");
         Assert.isTrue(4 == application.getRequestedClaims().size(),
                       "Number of claims doesn't match [" + application.getRequestedClaims().size()
+ "]");
     }
@@ -144,7 +147,10 @@ public class ApplicationDAOJPATest {
                       "ServiceDisplayName doesn't match");
         Assert.isTrue("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"
                       .equals(application.getTokenType()),
-                      "TokenType doesn't match");         
+                      "TokenType doesn't match");
+        Assert.isTrue("http://www.w3.org/ns/ws-policy"
+                      .equals(application.getPolicyNamespace()),
+                      "Policy Namespace doesn't match");
         Assert.isTrue(0 == application.getRequestedClaims().size(),
                       "Number of claims doesn't match");
     }
@@ -167,6 +173,7 @@ public class ApplicationDAOJPATest {
         application.setServiceDescription("UFedizhelloworld2 description");
         application.setServiceDisplayName("UFedizhelloworld2");
         application.setTokenType("Uhttp://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
+        application.setPolicyNamespace("Uhttp://www.w3.org/ns/ws-policy");
         
         Assert.isTrue("U".equals(application.getEncryptionCertificate()),
                       "EncryptionCertificate doesn't match");
@@ -184,7 +191,10 @@ public class ApplicationDAOJPATest {
                       "ServiceDisplayName doesn't match");
         Assert.isTrue("Uhttp://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"
                       .equals(application.getTokenType()),
-                      "TokenType doesn't match");         
+                      "TokenType doesn't match");
+        Assert.isTrue("Uhttp://www.w3.org/ns/ws-policy"
+                      .equals(application.getPolicyNamespace()),
+                      "Policy Namespace doesn't match");
         Assert.isTrue(0 == application.getRequestedClaims().size(),
                       "Number of claims doesn't match");
     }
@@ -342,6 +352,7 @@ public class ApplicationDAOJPATest {
         application.setServiceDescription("Fedizhelloworld2 description");
         application.setServiceDisplayName("Fedizhelloworld2");
         application.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
+        application.setPolicyNamespace("http://www.w3.org/ns/ws-policy");
         return application;
     }
 



Mime
View raw message