You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2017/04/03 13:54:03 UTC
svn commit: r1789997 - in
/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml:
bean/NameIDBean.java bean/SubjectBean.java builder/SAML2ComponentBuilder.java
Author: coheigea
Date: Mon Apr 3 13:54:03 2017
New Revision: 1789997
URL: http://svn.apache.org/viewvc?rev=1789997&view=rev
Log:
WSS-606 - Possibility to configure the SAML attribute //Assertion/Subject/NameID/@SPProvidedID in a CallbackHandler
- Thanks to Dmyrto Rud for the patch
Modified:
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/NameIDBean.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/SubjectBean.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/NameIDBean.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/NameIDBean.java?rev=1789997&r1=1789996&r2=1789997&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/NameIDBean.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/NameIDBean.java Mon Apr 3 13:54:03 2017
@@ -26,6 +26,7 @@ public class NameIDBean {
private String nameValue;
private String nameIDFormat = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified";
private String nameQualifier;
+ private String spProvidedID;
/**
* Constructor NameIDBean creates a new NameIDBean instance.
@@ -73,6 +74,14 @@ public class NameIDBean {
this.nameQualifier = nameQualifier;
}
+ public String getSPProvidedID() {
+ return spProvidedID;
+ }
+
+ public void setSPProvidedID(String spProvidedID) {
+ this.spProvidedID = spProvidedID;
+ }
+
/**
* Method equals ...
*
@@ -108,6 +117,12 @@ public class NameIDBean {
return false;
}
+ if (spProvidedID == null && that.spProvidedID != null) {
+ return false;
+ } else if (spProvidedID != null && !spProvidedID.equals(that.spProvidedID)) {
+ return false;
+ }
+
return true;
}
@@ -126,6 +141,9 @@ public class NameIDBean {
if (nameQualifier != null) {
result = 31 * result + nameQualifier.hashCode();
}
+ if (spProvidedID != null) {
+ result = 31 * result + spProvidedID.hashCode();
+ }
return result;
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/SubjectBean.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/SubjectBean.java?rev=1789997&r1=1789996&r2=1789997&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/SubjectBean.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/SubjectBean.java Mon Apr 3 13:54:03 2017
@@ -71,6 +71,26 @@ public class SubjectBean {
}
/**
+ * Constructor SubjectBean creates a new SubjectBean instance.
+ *
+ * @param subjectName of type String
+ * @param subjectNameQualifier of type String
+ * @param subjectConfirmationMethod of type String
+ * @param subjectNameIDFormat of type String
+ * @param subjectNameSPProvidedID of type String
+ */
+ public SubjectBean(
+ String subjectName,
+ String subjectNameQualifier,
+ String subjectConfirmationMethod,
+ String subjectNameIDFormat,
+ String subjectNameSPProvidedID
+ ) {
+ this(subjectName, subjectNameQualifier, subjectConfirmationMethod, subjectNameIDFormat);
+ nameID.setSPProvidedID(subjectNameSPProvidedID);
+ }
+
+ /**
* Method getSubjectName returns the subjectName of this SubjectBean object.
*
* @return the subjectName (type String) of this SubjectBean object.
@@ -147,6 +167,14 @@ public class SubjectBean {
nameID.setNameIDFormat(subjectNameIDFormat);
}
+ public String getSubjectNameSPProvidedID() {
+ return nameID.getSPProvidedID();
+ }
+
+ public void setSubjectNameSPProvidedID(String subjectNameSPProvidedID) {
+ nameID.setSPProvidedID(subjectNameSPProvidedID);
+ }
+
/**
* Method getKeyInfo returns the keyInfo of this SubjectBean object.
*
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java?rev=1789997&r1=1789996&r2=1789997&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java Mon Apr 3 13:54:03 2017
@@ -716,6 +716,7 @@ public final class SAML2ComponentBuilder
NameIDBean nameIDBean = new NameIDBean();
nameIDBean.setNameIDFormat(subject.getSubjectNameIDFormat());
nameIDBean.setNameQualifier(subject.getSubjectNameQualifier());
+ nameIDBean.setSPProvidedID(subject.getSubjectNameSPProvidedID());
nameIDBean.setNameValue(subject.getSubjectName());
return createNameID(nameIDBean);
}
@@ -730,6 +731,7 @@ public final class SAML2ComponentBuilder
nameID.setNameQualifier(nameIDBean.getNameQualifier());
nameID.setFormat(nameIDBean.getNameIDFormat());
nameID.setValue(nameIDBean.getNameValue());
+ nameID.setSPProvidedID(nameIDBean.getSPProvidedID());
return nameID;
}