summaryrefslogtreecommitdiff
path: root/eaaf_modules
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2021-01-05 18:30:21 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2021-01-05 18:30:21 +0100
commit228d4e40cfb8fc3fa7912064af3768a74beb9312 (patch)
tree4363383ca58e76f2640c1c6e98ae50c55e63ef55 /eaaf_modules
parent930c0e26fc1fe8bb9b457571d7df92904d1e7616 (diff)
downloadEAAF-Components-228d4e40cfb8fc3fa7912064af3768a74beb9312.tar.gz
EAAF-Components-228d4e40cfb8fc3fa7912064af3768a74beb9312.tar.bz2
EAAF-Components-228d4e40cfb8fc3fa7912064af3768a74beb9312.zip
add new method into SAML2 AuthnRequest builder to set relaystate from external
Diffstat (limited to 'eaaf_modules')
-rw-r--r--eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/PvpAuthnRequestBuilder.java46
1 files changed, 33 insertions, 13 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/PvpAuthnRequestBuilder.java b/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/PvpAuthnRequestBuilder.java
index 752386a0..c6ca8d04 100644
--- a/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/PvpAuthnRequestBuilder.java
+++ b/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/PvpAuthnRequestBuilder.java
@@ -24,18 +24,6 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
-import at.gv.egiz.eaaf.core.api.IRequest;
-import at.gv.egiz.eaaf.modules.pvp2.api.binding.IEncoder;
-import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EaafRequestedAttribute;
-import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EaafRequestedAttributes;
-import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2Exception;
-import at.gv.egiz.eaaf.modules.pvp2.impl.binding.PostBinding;
-import at.gv.egiz.eaaf.modules.pvp2.impl.binding.RedirectBinding;
-import at.gv.egiz.eaaf.modules.pvp2.impl.builder.reqattr.EaafRequestExtensionBuilder;
-import at.gv.egiz.eaaf.modules.pvp2.impl.utils.Saml2Utils;
-import at.gv.egiz.eaaf.modules.pvp2.sp.api.IPvpAuthnRequestBuilderConfiguruation;
-import at.gv.egiz.eaaf.modules.pvp2.sp.exception.AuthnRequestBuildException;
-
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.opensaml.messaging.encoder.MessageEncodingException;
@@ -61,6 +49,17 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.modules.pvp2.api.binding.IEncoder;
+import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EaafRequestedAttribute;
+import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EaafRequestedAttributes;
+import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2Exception;
+import at.gv.egiz.eaaf.modules.pvp2.impl.binding.PostBinding;
+import at.gv.egiz.eaaf.modules.pvp2.impl.binding.RedirectBinding;
+import at.gv.egiz.eaaf.modules.pvp2.impl.builder.reqattr.EaafRequestExtensionBuilder;
+import at.gv.egiz.eaaf.modules.pvp2.impl.utils.Saml2Utils;
+import at.gv.egiz.eaaf.modules.pvp2.sp.api.IPvpAuthnRequestBuilderConfiguruation;
+import at.gv.egiz.eaaf.modules.pvp2.sp.exception.AuthnRequestBuildException;
import net.shibboleth.utilities.java.support.security.SecureRandomIdentifierGenerationStrategy;
/**
@@ -75,6 +74,8 @@ public class PvpAuthnRequestBuilder {
@Autowired(required = true)
ApplicationContext springContext;
+
+
/**
* Build a PVP2.x specific authentication request
*
@@ -89,6 +90,25 @@ public class PvpAuthnRequestBuilder {
public void buildAuthnRequest(final IRequest pendingReq,
final IPvpAuthnRequestBuilderConfiguruation config, final HttpServletResponse httpResp)
throws NoSuchAlgorithmException, MessageEncodingException, Pvp2Exception, SecurityException {
+ buildAuthnRequest(pendingReq, config, pendingReq.getPendingRequestId(), httpResp);
+
+ }
+
+ /**
+ * Build a PVP2.x specific authentication request
+ *
+ * @param pendingReq Currently processed pendingRequest
+ * @param config AuthnRequest builder configuration, never null
+ * @param relayState RelayState that should used for communication
+ * @param httpResp http response object
+ * @throws NoSuchAlgorithmException In case of error
+ * @throws SecurityException In case of error
+ * @throws Pvp2Exception In case of error
+ * @throws MessageEncodingException In case of error
+ */
+ public void buildAuthnRequest(final IRequest pendingReq,
+ final IPvpAuthnRequestBuilderConfiguruation config, String relayState, final HttpServletResponse httpResp)
+ throws NoSuchAlgorithmException, MessageEncodingException, Pvp2Exception, SecurityException {
// get IDP Entity element from config
final EntityDescriptor idpEntity = config.getIdpEntityDescriptor();
@@ -259,7 +279,7 @@ public class PvpAuthnRequestBuilder {
// encode message
binding.encodeRequest(null, httpResp, authReq, endpoint.getLocation(),
- pendingReq.getPendingRequestId(), config.getAuthnRequestSigningCredential(), pendingReq);
+ relayState, config.getAuthnRequestSigningCredential(), pendingReq);
}
}