cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/4] cxf-fediz git commit: Adding a switch to sign a request to a trusted IdP
Date Mon, 16 Mar 2015 17:51:29 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master ecd25ab9d -> 799afc9a2


Adding a switch to sign a request to a trusted IdP


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

Branch: refs/heads/master
Commit: fd366100082d221c1c8b75cc85552b6d04ee4afc
Parents: ecd25ab
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Mar 16 15:55:50 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Mar 16 15:55:50 2015 +0000

----------------------------------------------------------------------
 .../cxf/fediz/service/idp/domain/TrustedIdp.java       | 13 ++++++++++++-
 .../service/idp/service/jpa/TrustedIdpEntity.java      | 11 +++++++++++
 .../cxf/fediz/service/idp/util/MetadataWriter.java     |  3 ++-
 3 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/fd366100/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/TrustedIdp.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/TrustedIdp.java
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/TrustedIdp.java
index dbdea59..6469372 100644
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/TrustedIdp.java
+++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/domain/TrustedIdp.java
@@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "trustedIdp", namespace = "http://org.apache.cxf.fediz/")
 @XmlType(propOrder = {"realm", "url", "name", "description", "protocol", "trustType",
-                      "certificate", "federationType", "cacheTokens", "logo", "id" })
+                      "certificate", "federationType", "cacheTokens", "logo", "id", "signRequest"
})
 //@XmlAttribute on Id must be set on getter, not on attribute, otherwise error
 public class TrustedIdp implements Serializable {
 
@@ -68,6 +68,9 @@ public class TrustedIdp implements Serializable {
     
     //optional (to provide a list of IDPs)
     protected String logo;
+    
+    // Whether to sign a request to the trusted IdP or not
+    private boolean signRequest;
 
     
     @XmlAttribute
@@ -158,6 +161,14 @@ public class TrustedIdp implements Serializable {
     public void setTrustType(TrustType trustType) {
         this.trustType = trustType;
     }
+
+    public boolean isSignRequest() {
+        return signRequest;
+    }
+
+    public void setSignRequest(boolean signRequest) {
+        this.signRequest = signRequest;
+    }
                
 
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/fd366100/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
index 7f41186..11785c7 100644
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
+++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
@@ -76,6 +76,9 @@ public class TrustedIdpEntity {
     //optional (to provide a list of IDPs)
     private String logo;
     
+    // Whether to sign a request to the trusted IdP or not
+    private boolean signRequest;
+    
 
     public int getId() {
         return id;
@@ -165,4 +168,12 @@ public class TrustedIdpEntity {
         this.trustType = trustType;
     }
 
+    public boolean isSignRequest() {
+        return signRequest;
+    }
+
+    public void setSignRequest(boolean signRequest) {
+        this.signRequest = signRequest;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/fd366100/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
index bc34ab4..bcc7e37 100644
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
+++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
@@ -104,7 +104,8 @@ public class MetadataWriter {
             writer.writeStartElement("", "X509Certificate", "http://www.w3.org/2000/09/xmldsig#");
             
             try {
-                X509Certificate cert = CertsUtils.getX509Certificate(crypto, null);
+                String keyAlias = crypto.getDefaultX509Identifier();
+                X509Certificate cert = CertsUtils.getX509Certificate(crypto, keyAlias);
                 writer.writeCharacters(Base64.encode(cert.getEncoded()));
             } catch (Exception ex) {
                 LOG.error("Failed to add certificate information to metadata. Metadata incomplete",
ex);


Mime
View raw message