summaryrefslogtreecommitdiff
path: root/eaaf_modules/eaaf_module_pvp2_idp/src/main
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2021-01-25 19:03:25 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2021-01-25 19:03:38 +0100
commitb3caa532978b6337b6015b08c17ec0466d6f9670 (patch)
treef8f4c1e6ee4395bd99e4cc59f7f00411d037b74f /eaaf_modules/eaaf_module_pvp2_idp/src/main
parent6116a5aeea9fbf519c6f28fd17c65007cd0cbf64 (diff)
downloadEAAF-Components-b3caa532978b6337b6015b08c17ec0466d6f9670.tar.gz
EAAF-Components-b3caa532978b6337b6015b08c17ec0466d6f9670.tar.bz2
EAAF-Components-b3caa532978b6337b6015b08c17ec0466d6f9670.zip
refactor PVP2 IDP module to support more than one IPvpMetadataProvider in one application
Diffstat (limited to 'eaaf_modules/eaaf_module_pvp2_idp/src/main')
-rw-r--r--eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java16
-rw-r--r--eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AuthenticationAction.java16
2 files changed, 20 insertions, 12 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java
index 8da76265..50fd0f44 100644
--- a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java
+++ b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java
@@ -43,6 +43,7 @@ import org.opensaml.xmlsec.signature.SignableXMLObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.Assert;
import at.gv.egiz.components.eventlog.api.EventConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
@@ -77,6 +78,7 @@ import at.gv.egiz.eaaf.modules.pvp2.impl.utils.Saml2Utils;
import at.gv.egiz.eaaf.modules.pvp2.impl.validation.EaafUriCompare;
import at.gv.egiz.eaaf.modules.pvp2.impl.validation.TrustEngineFactory;
import at.gv.egiz.eaaf.modules.pvp2.impl.verification.SamlVerificationEngine;
+import lombok.Setter;
public abstract class AbstractPvp2XProtocol extends AbstractController implements IModulInfo {
private static final Logger log = LoggerFactory.getLogger(AbstractPvp2XProtocol.class);
@@ -87,12 +89,16 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement
@Autowired(required = true)
protected IPvp2BasicConfiguration pvpBasicConfiguration;
@Autowired(required = true)
- protected IPvp2MetadataProvider metadataProvider;
- @Autowired(required = true)
protected SamlVerificationEngine samlVerificationEngine;
@Autowired(required = false)
protected List<IAuthnRequestPostProcessor> authRequestPostProcessors;
+ /**
+ * SAML2 metadata provider that should be used in this component.
+ */
+ @Setter
+ protected IPvp2MetadataProvider metadataProvider;
+
private IPvp2CredentialProvider pvpIdpCredentials;
/**
@@ -554,11 +560,9 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement
@PostConstruct
private void verifyInitialization() {
- if (pvpIdpCredentials == null) {
- log.error("No SAML2 credentialProvider injected!");
- throw new RuntimeException("No SAML2 credentialProvider injected!");
+ Assert.notNull(metadataProvider, "No SAML2 MetadataProvider injected!");
+ Assert.notNull(pvpIdpCredentials, "No SAML2 credentialProvider injected!");
- }
}
}
diff --git a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AuthenticationAction.java b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AuthenticationAction.java
index f9d7767f..68ba39a3 100644
--- a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AuthenticationAction.java
+++ b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AuthenticationAction.java
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.idp.IAction;
@@ -56,14 +57,13 @@ 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.message.PvpSProfileRequest;
import at.gv.egiz.eaaf.modules.pvp2.impl.utils.Saml2Utils;
+import lombok.Setter;
@Service("PVPAuthenticationRequestAction")
public class AuthenticationAction implements IAction {
private static final Logger log = LoggerFactory.getLogger(AuthenticationAction.class);
@Autowired(required = true)
- private IPvp2MetadataProvider metadataProvider;
- @Autowired(required = true)
ApplicationContext springContext;
@Autowired(required = true)
IConfiguration authConfig;
@@ -74,6 +74,12 @@ public class AuthenticationAction implements IAction {
@Autowired(required = true)
IRevisionLogger revisionsLogger;
+ /**
+ * SAML2 metadata provider that should be used in this component.
+ */
+ @Setter
+ protected IPvp2MetadataProvider metadataProvider;
+
private IPvp2CredentialProvider pvpIdpCredentials;
/**
@@ -168,11 +174,9 @@ public class AuthenticationAction implements IAction {
@PostConstruct
private void verifyInitialization() {
- if (pvpIdpCredentials == null) {
- log.error("No SAML2 credentialProvider injected!");
- throw new RuntimeException("No SAML2 credentialProvider injected!");
+ Assert.notNull(metadataProvider, "No SAML2 MetadataProvider injected!");
+ Assert.notNull(pvpIdpCredentials, "No SAML2 credentialProvider injected!");
- }
}
}