summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-02-20 09:43:03 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-02-20 09:43:03 +0100
commita57a2ed851b818456421f3ce082dc6813da6b736 (patch)
treeb4c9c4c9f7c317ff3f0686d7427366203bdd9347 /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
parent9e26dd0833cd3a6bfb6f15cc11727cdc8e14d260 (diff)
downloadEAAF-Components-a57a2ed851b818456421f3ce082dc6813da6b736.tar.gz
EAAF-Components-a57a2ed851b818456421f3ce082dc6813da6b736.tar.bz2
EAAF-Components-a57a2ed851b818456421f3ce082dc6813da6b736.zip
add two jUnit test and CodeStyle modifications
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
index f5c687f1..8f87cbfa 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
@@ -26,17 +26,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Map.Entry;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.lang.NonNull;
-import org.springframework.util.Assert;
-import org.springframework.util.Base64Utils;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;
@@ -60,6 +49,17 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser;
import at.gv.egiz.eaaf.core.impl.utils.XPathUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.lang.NonNull;
+import org.springframework.util.Assert;
+import org.springframework.util.Base64Utils;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
public abstract class AbstractAuthenticationDataBuilder implements IAuthenticationDataBuilder {
private static final Logger log =
LoggerFactory.getLogger(AbstractAuthenticationDataBuilder.class);
@@ -145,10 +145,11 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
* @param authProcessData Authentication information holder from current pending
* request
* @param pendingReq current pending request
+ * @throws EaafAuthenticationException In case inconsistent authentication data
*/
private void buildInternalAuthDataGeneric(@NonNull final IAuthData authData,
@NonNull final IAuthProcessDataContainer authProcessData,
- @NonNull final IRequest pendingReq) {
+ @NonNull final IRequest pendingReq) throws EaafAuthenticationException {
Assert.notNull(pendingReq, "PendingRequest is null");
Assert.notNull(authData, "AuthData is null");
Assert.notNull(authProcessData, "AuthProcessData is null");
@@ -227,9 +228,10 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
* @param authData Current authentication data
* @param authProcessData Authentication information holder from current pending
* request
+ * @throws EaafAuthenticationException In case inconsistent authentication data
*/
private void setCitizenCountryCode(final AuthenticationData authData,
- final IAuthProcessDataContainer authProcessData) {
+ final IAuthProcessDataContainer authProcessData) throws EaafAuthenticationException {
includedToGenericAuthData.remove(PvpAttributeDefinitions.EID_ISSUING_NATION_NAME);
final String pvpCccAttr = authProcessData
.getGenericDataFromSession(PvpAttributeDefinitions.EID_ISSUING_NATION_NAME, String.class);
@@ -239,8 +241,9 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
} else {
if (authData.isForeigner()) {
- // TODO:
- log.warn("Foreign citizen country NOT set yet!");
+ log.warn("EID_Issuing_Nation NOT SET for foreign citizen.");
+ throw new EaafAuthenticationException("builder.11",
+ new Object[] { "EID_Issuing_Nation NOT SET for foreign citizen." });
} else {
authData.setCiticenCountryCode(basicConfig.getBasicConfiguration(
@@ -324,7 +327,7 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
protected void generateDeprecatedBasicAuthData(final AuthenticationData authData,
final IRequest pendingReq, final IAuthProcessDataContainer authProcessData)
throws EaafBuilderException, EaafConfigurationException, XPathException, DOMException,
- EaafParserException {
+ EaafParserException, EaafAuthenticationException {
if (authProcessData.getGenericSessionDataStorage() != null
&& !authProcessData.getGenericSessionDataStorage().isEmpty()) {