summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-09-08 15:55:12 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-09-08 15:55:12 +0200
commitbb54c6e5da78d4b1d37945779bdc7cb4bd3331c7 (patch)
tree3a822f59f9c431cbff0449fbb1b700dd54dfedb4 /eaaf_core/src/main/java
parent37ef7d68ef58f0ead21b69a3b1b14980b9cb9ce3 (diff)
parentd754d9af2e9bf0660a0dcedfcd3a98588899e27a (diff)
downloadEAAF-Components-bb54c6e5da78d4b1d37945779bdc7cb4bd3331c7.tar.gz
EAAF-Components-bb54c6e5da78d4b1d37945779bdc7cb4bd3331c7.tar.bz2
EAAF-Components-bb54c6e5da78d4b1d37945779bdc7cb4bd3331c7.zip
Merge branch 'nightlyBuild' of gitlab.iaik.tugraz.at:egiz/eaaf_components into nightlyBuild
Diffstat (limited to 'eaaf_core/src/main/java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java
index 7b9ffcf0..81d50d76 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java
@@ -28,19 +28,19 @@ import java.util.Date;
import java.util.Map.Entry;
import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.Base64Utils;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.exceptions.EaafBuilderException;
-import at.gv.egiz.eaaf.core.impl.data.Pair;
import lombok.extern.slf4j.Slf4j;
@@ -53,9 +53,12 @@ import lombok.extern.slf4j.Slf4j;
*/
@Slf4j
public class BpkBuilder {
+
+ private static final String ERROR_CODE_33 = "builder.33";
private static final String ERROR_MSG_WRONG_TARGET_FORMAT = "bPK-target format must be full URI";
+
/**
* Calculates an area specific unique person-identifier from a baseID.
*
@@ -88,17 +91,17 @@ public class BpkBuilder {
public static Pair<String, String> generateAreaSpecificPersonIdentifier(final String baseID,
final String baseIdType, final String targetIdentifier) throws EaafBuilderException {
if (StringUtils.isEmpty(baseID)) {
- throw new EaafBuilderException("builder.00", new Object[] { "baseID is empty or null" },
+ throw new EaafBuilderException(ERROR_CODE_33, new Object[] { "baseID is empty or null" },
"BaseId is empty or null");
}
if (StringUtils.isEmpty(baseIdType)) {
- throw new EaafBuilderException("builder.00",
+ throw new EaafBuilderException(ERROR_CODE_33,
new Object[] { "the type of baseID is empty or null" }, "Type of baseId is empty or null");
}
if (StringUtils.isEmpty(targetIdentifier)) {
- throw new EaafBuilderException("builder.00",
+ throw new EaafBuilderException(ERROR_CODE_33,
new Object[] { "SP specific target identifier is empty or null" },
"SP specific target identifier is empty or null");
}
@@ -130,7 +133,7 @@ public class BpkBuilder {
return buildEidasIdentifer(baseID, baseIdType, cititzenCountryCode, eidasOutboundCountry);
} else {
- throw new EaafBuilderException("builder.00",
+ throw new EaafBuilderException(ERROR_CODE_33,
new Object[] { "Target identifier: " + targetIdentifier + " is NOT allowed or unknown" },
"Target identifier: " + targetIdentifier + " is NOT allowed or unknown");
}
@@ -145,7 +148,7 @@ public class BpkBuilder {
} else {
log.warn("Get unique identifier for target: " + baseIdType + " but target: "
+ targetIdentifier + " is required!");
- throw new EaafBuilderException("builder.00",
+ throw new EaafBuilderException(ERROR_CODE_33,
new Object[] { "Get unique identifier for target: " + baseIdType + " but target: "
+ targetIdentifier + " is required" },
"Get unique identifier for target: " + baseIdType + " but target: " + targetIdentifier
@@ -373,7 +376,7 @@ public class BpkBuilder {
return hashBase64;
} catch (final Exception ex) {
- throw new EaafBuilderException("builder.00", new Object[] { "bPK/wbPK", ex.toString() },
+ throw new EaafBuilderException(ERROR_CODE_33, new Object[] {ex.toString() },
ex.getMessage(), ex);
}