Skip to content

Commit

Permalink
Updating to WSS4J 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
coheigea committed Oct 17, 2023
1 parent d17fe34 commit d00f745
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
<cxf.woodstox.core.version>6.5.1</cxf.woodstox.core.version>
<cxf.woodstox.stax2-api.version>4.2.1</cxf.woodstox.stax2-api.version>
<cxf.wsdl4j.version>1.6.3</cxf.wsdl4j.version>
<cxf.jakarta.wss4j.version>3.0.1</cxf.jakarta.wss4j.version>
<cxf.jakarta.wss4j.version>4.0.0-SNAPSHOT</cxf.jakarta.wss4j.version>
<cxf.xmlschema.version>2.3.1</cxf.xmlschema.version>
<cxf.xnio.version>3.8.11.Final</cxf.xnio.version>
<cxf.zest.version>2.1</cxf.zest.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void validateAudience(Message message, Conditions cs) {
for (AudienceRestriction ar : restrictions) {
List<Audience> audiences = ar.getAudiences();
for (Audience a : audiences) {
if (absoluteAddress.equals(a.getAudienceURI())) {
if (absoluteAddress.equals(a.getURI())) {
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private boolean matchSaml2AudienceRestriction(
if (audienceRestriction.getAudiences() != null) {
boolean matchFound = false;
for (org.opensaml.saml.saml2.core.Audience audience : audienceRestriction.getAudiences()) {
if (appliesTo.equals(audience.getAudienceURI())) {
if (appliesTo.equals(audience.getURI())) {
matchFound = true;
oneMatchFound = true;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static AuthnContextClassRef createAuthnCtxClassRef(
builderFactory.getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
}
AuthnContextClassRef authnCtxClassRef = requestedAuthnCtxClassRefBuilder.buildObject();
authnCtxClassRef.setAuthnContextClassRef(authnCtxClassRefValue);
authnCtxClassRef.setURI(authnCtxClassRefValue);

return authnCtxClassRef;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ public void testResponseModifiedSignedAssertion() throws Exception {
DOMUtils.findAllElementsByTagNameNS(policyElement, SAMLConstants.SAML20_NS, "Assertion");
assertNotNull(assertions);
assertTrue(assertions.size() == 1);
assertions.get(0).setAttributeNS(null, "newattr", "http://apache.org");
Thread.sleep(1000L);
Instant issueInstant = Instant.now();
assertions.get(0).setAttributeNS(null, "IssueInstant", issueInstant.toString());

Response marshalledResponse = (Response)OpenSAMLUtil.fromDom(policyElement);

Expand Down Expand Up @@ -395,7 +397,9 @@ public void testModifiedSignedResponse() throws Exception {
doc.appendChild(policyElement);
assertNotNull(policyElement);

policyElement.setAttributeNS(null, "newattr", "http://apache.org");
Thread.sleep(1000L);
Instant issueInstant = Instant.now();
policyElement.setAttributeNS(null, "IssueInstant", issueInstant.toString());

Response marshalledResponse = (Response)OpenSAMLUtil.fromDom(policyElement);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import javax.xml.namespace.QName;

import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
import net.shibboleth.shared.xml.DOMTypeSupport;
import org.apache.cxf.message.Message;
import org.apache.cxf.rt.security.saml.xacml.CXFMessageParser;
import org.apache.cxf.rt.security.saml.xacml.XACMLConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
import net.shibboleth.shared.xml.DOMTypeSupport;
import org.apache.cxf.rt.security.saml.xacml.XACMLConstants;
import org.apache.wss4j.common.saml.OpenSAMLUtil;
import org.opensaml.xacml.ctx.ActionType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ protected List<String> getAudienceRestrictions(SamlAssertionWrapper assertion) {
for (AudienceRestrictionCondition restriction
: assertion.getSaml1().getConditions().getAudienceRestrictionConditions()) {
for (org.opensaml.saml.saml1.core.Audience audience : restriction.getAudiences()) {
addresses.add(audience.getUri());
addresses.add(audience.getURI());
}
}
} else if (assertion.getSaml2() != null) {
for (org.opensaml.saml.saml2.core.AudienceRestriction restriction
: assertion.getSaml2().getConditions().getAudienceRestrictions()) {
for (org.opensaml.saml.saml2.core.Audience audience : restriction.getAudiences()) {
addresses.add(audience.getAudienceURI());
addresses.add(audience.getURI());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ private boolean matchSaml1AudienceRestriction(
for (AudienceRestrictionCondition restrCondition : restrConditions) {
if (restrCondition.getAudiences() != null) {
for (Audience audience : restrCondition.getAudiences()) {
if (appliesTo.equals(audience.getUri())) {
if (appliesTo.equals(audience.getURI())) {
return true;
}
}
Expand All @@ -409,7 +409,7 @@ private boolean matchSaml2AudienceRestriction(
for (AudienceRestriction audienceRestriction : audienceRestrictions) {
if (audienceRestriction.getAudiences() != null) {
for (org.opensaml.saml.saml2.core.Audience audience : audienceRestriction.getAudiences()) {
if (appliesTo.equals(audience.getAudienceURI())) {
if (appliesTo.equals(audience.getURI())) {
return true;
}
}
Expand Down

0 comments on commit d00f745

Please sign in to comment.