summaryrefslogtreecommitdiff
path: root/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/SecurePendingRequestIdGenerationStrategy.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/SecurePendingRequestIdGenerationStrategy.java')
-rw-r--r--eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/SecurePendingRequestIdGenerationStrategy.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/SecurePendingRequestIdGenerationStrategy.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/SecurePendingRequestIdGenerationStrategy.java
index ee88c4bb..bc770a8c 100644
--- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/SecurePendingRequestIdGenerationStrategy.java
+++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/SecurePendingRequestIdGenerationStrategy.java
@@ -8,17 +8,13 @@ import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import java.util.Base64;
+
import javax.annotation.PostConstruct;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
-import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy;
-import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
-import at.gv.egiz.eaaf.core.exceptions.EaafException;
-import at.gv.egiz.eaaf.core.exceptions.EaafIllegalStateException;
-import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException;
+
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.DurationFieldType;
@@ -30,9 +26,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
+import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
+import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy;
+import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import at.gv.egiz.eaaf.core.exceptions.EaafIllegalStateException;
+import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException;
+
/**
- * PendingRequestId generation strategy based on signed tokens that facilitates extended token
- * validation.
+ * PendingRequestId generation strategy based on signed tokens that facilitates
+ * extended token validation.
*
* @author tlenz
*
@@ -78,7 +81,7 @@ public class SecurePendingRequestIdGenerationStrategy
.encodeToString(externalPendingRequestId.toString().getBytes("UTF-8"));
} catch (final UnsupportedEncodingException e) {
- throw new EaafException("internal.99", new Object[] {e.getMessage()}, e);
+ throw new EaafException("internal.99", new Object[] { e.getMessage() }, e);
}
@@ -131,7 +134,6 @@ public class SecurePendingRequestIdGenerationStrategy
return internalPendingReqId;
-
} catch (final IllegalArgumentException | EaafIllegalStateException e) {
log.warn("Token is NOT a valid String. Msg: {}", e.getMessage());
log.debug("TokenValue: {}", externalPendingReqId);
@@ -177,7 +179,6 @@ public class SecurePendingRequestIdGenerationStrategy
}
-
@PostConstruct
private void initialize() throws EaafConfigurationException {
log.debug("Initializing " + this.getClass().getName() + " ... ");
@@ -186,7 +187,7 @@ public class SecurePendingRequestIdGenerationStrategy
baseConfig.getBasicConfiguration(CONFIG_PROP_PENDINGREQUESTID_DIGIST_SECRET);
if (StringUtils.isEmpty(pendingReqIdDigistSecret)) {
throw new EaafConfigurationException("config.08",
- new Object[] {CONFIG_PROP_PENDINGREQUESTID_DIGIST_SECRET});
+ new Object[] { CONFIG_PROP_PENDINGREQUESTID_DIGIST_SECRET });
}
digistAlgorithm = baseConfig.getBasicConfiguration(
@@ -201,11 +202,10 @@ public class SecurePendingRequestIdGenerationStrategy
final KeySpec spec = new PBEKeySpec(pendingReqIdDigistSecret.toCharArray(), salt, 10000, 128);
key = keyFactory.generateSecret(spec);
-
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
log.error("Can NOT initialize TokenService with configuration object", e);
throw new EaafConfigurationException("config.09",
- new Object[] {CONFIG_PROP_PENDINGREQUESTID_DIGIST_SECRET, "Can NOT generate HMAC key"},
+ new Object[] { CONFIG_PROP_PENDINGREQUESTID_DIGIST_SECRET, "Can NOT generate HMAC key" },
e);
}
@@ -229,7 +229,7 @@ public class SecurePendingRequestIdGenerationStrategy
} catch (UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException e) {
log.error("Can NOT generate secure pendingRequestId", e);
throw new EaafIllegalStateException(
- new Object[] {"Can NOT caluclate digist for secure pendingRequestId"}, e);
+ new Object[] { "Can NOT caluclate digist for secure pendingRequestId" }, e);
}