From 7f00c5957134e95e5b59b1546388f4e49051f094 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 8 May 2014 10:17:09 +0200 Subject: add methode to get SAML2 binding URL --- .../moa/id/protocols/pvp2x/binding/ArtifactBinding.java | 4 ++++ .../gv/egovernment/moa/id/protocols/pvp2x/binding/IDecoder.java | 2 ++ .../egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java | 8 ++++++-- .../moa/id/protocols/pvp2x/binding/RedirectBinding.java | 6 +++++- .../egovernment/moa/id/protocols/pvp2x/binding/SoapBinding.java | 6 +++++- 5 files changed, 22 insertions(+), 4 deletions(-) (limited to 'id/server/idserverlib/src/main/java/at') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/ArtifactBinding.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/ArtifactBinding.java index 6801d25d5..8691667f0 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/ArtifactBinding.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/ArtifactBinding.java @@ -113,5 +113,9 @@ public class ArtifactBinding implements IDecoder, IEncoder { return false; } + + public String getSAML2BindingName() { + return SAMLConstants.SAML2_ARTIFACT_BINDING_URI; + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/IDecoder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/IDecoder.java index 108caf047..fb17c02b8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/IDecoder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/IDecoder.java @@ -37,4 +37,6 @@ public interface IDecoder { throws MessageDecodingException, SecurityException, PVP2Exception; public boolean handleDecode(String action, HttpServletRequest req); + + public String getSAML2BindingName(); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java index 020055139..a2fe5c01b 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java @@ -36,6 +36,7 @@ import org.opensaml.saml2.core.Response; import org.opensaml.saml2.core.StatusResponseType; import org.opensaml.saml2.metadata.IDPSSODescriptor; import org.opensaml.saml2.metadata.SPSSODescriptor; +import org.opensaml.saml2.metadata.SingleLogoutService; import org.opensaml.saml2.metadata.SingleSignOnService; import org.opensaml.saml2.metadata.impl.SingleSignOnServiceBuilder; import org.opensaml.ws.message.decoder.MessageDecodingException; @@ -163,7 +164,7 @@ public class PostBinding implements IDecoder, IEncoder { RequestAbstractType inboundMessage = (RequestAbstractType) messageContext .getInboundMessage(); - msg = new MOARequest(inboundMessage); + msg = new MOARequest(inboundMessage, getSAML2BindingName()); } else if (messageContext.getInboundMessage() instanceof Response){ messageContext.setPeerEntityRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME); @@ -192,5 +193,8 @@ public class PostBinding implements IDecoder, IEncoder { public boolean handleDecode(String action, HttpServletRequest req) { return (req.getMethod().equals("POST") && action.equals(PVP2XProtocol.POST)); } - + + public String getSAML2BindingName() { + return SAMLConstants.SAML2_POST_BINDING_URI; + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/RedirectBinding.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/RedirectBinding.java index 68069f3a5..f5dba014b 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/RedirectBinding.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/RedirectBinding.java @@ -168,7 +168,7 @@ public class RedirectBinding implements IDecoder, IEncoder { RequestAbstractType inboundMessage = (RequestAbstractType) messageContext .getInboundMessage(); - msg = new MOARequest(inboundMessage); + msg = new MOARequest(inboundMessage, getSAML2BindingName()); } else if (messageContext.getInboundMessage() instanceof Response){ @@ -200,4 +200,8 @@ public class RedirectBinding implements IDecoder, IEncoder { return (action.equals(PVP2XProtocol.REDIRECT) && req.getMethod() .equals("GET")); } + + public String getSAML2BindingName() { + return SAMLConstants.SAML2_REDIRECT_BINDING_URI; + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/SoapBinding.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/SoapBinding.java index ec7c117b9..048c7f14c 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/SoapBinding.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/SoapBinding.java @@ -78,7 +78,7 @@ public class SoapBinding implements IDecoder, IEncoder { if (!xmlElemList.isEmpty()) { SignableXMLObject attrReq = (SignableXMLObject) xmlElemList.get(0); - MOARequest request = new MOARequest(attrReq); + MOARequest request = new MOARequest(attrReq, getSAML2BindingName()); request.setVerified(false); return request; @@ -122,5 +122,9 @@ public class SoapBinding implements IDecoder, IEncoder { throw new SecurityException(e); } } + + public String getSAML2BindingName() { + return SAMLConstants.SAML2_SOAP11_BINDING_URI; + } } -- cgit v1.2.3