summaryrefslogtreecommitdiff
path: root/eaaf_core/src
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java21
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java31
2 files changed, 29 insertions, 23 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java
index 4fe22feb..e1646fb8 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java
@@ -23,6 +23,7 @@ import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.time.Instant;
import java.util.Date;
import java.util.Map;
import java.util.TimeZone;
@@ -57,7 +58,7 @@ public class AuthenticationData implements IAuthData, Serializable {
private final Map<String, Object> genericDataStorate = new HashedMap<>();
private String issuer;
- private Date issueInstant;
+ private Instant issueInstant;
@Deprecated
private String identificationValue;
@@ -82,14 +83,14 @@ public class AuthenticationData implements IAuthData, Serializable {
private String eidasLoa = null;
private boolean ssoSession = false;
- private Date ssoSessionValidTo = null;
+ private Instant ssoSessionValidTo = null;
private String sessionIndex = null;
private String nameID = null;
private String nameIdFormat = null;
public AuthenticationData() {
- this.issueInstant = new Date();
+ this.issueInstant = Instant.now();
}
@@ -109,7 +110,7 @@ public class AuthenticationData implements IAuthData, Serializable {
}
@Override
- public Date getAuthenticationIssueInstant() {
+ public Instant getAuthenticationIssueInstant() {
return getDateCopyOrNull(this.issueInstant);
}
@@ -127,7 +128,7 @@ public class AuthenticationData implements IAuthData, Serializable {
*
* @param date Authentication data
*/
- public void setAuthenticationIssueInstant(final Date date) {
+ public void setAuthenticationIssueInstant(final Instant date) {
this.issueInstant = getDateCopyOrNull(date);
}
@@ -396,7 +397,7 @@ public class AuthenticationData implements IAuthData, Serializable {
* @return the ssoSessionValidTo
*/
@Override
- public Date getSsoSessionValidTo() {
+ public Instant getSsoSessionValidTo() {
return getDateCopyOrNull(ssoSessionValidTo);
}
@@ -405,7 +406,7 @@ public class AuthenticationData implements IAuthData, Serializable {
*
* @param ssoSessionValidTo the ssoSessionValidTo to set
*/
- public void setSsoSessionValidTo(final Date ssoSessionValidTo) {
+ public void setSsoSessionValidTo(final Instant ssoSessionValidTo) {
this.ssoSessionValidTo = getDateCopyOrNull(ssoSessionValidTo);
}
@@ -519,10 +520,12 @@ public class AuthenticationData implements IAuthData, Serializable {
this.encSourceIdType = encSourceIdType;
}
- private Date getDateCopyOrNull(Date in) {
+ private Instant getDateCopyOrNull(Instant in) {
if (in != null) {
- return new Date(in.getTime());
+ return Instant.from(in);
+
} else {
+
return null;
}
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
index 368652be..383b4535 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
@@ -21,10 +21,12 @@ package at.gv.egiz.eaaf.core.impl.idp.auth.data;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.TimeZone;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -54,8 +56,8 @@ public class AuthProcessDataWrapper
}
@Override
- public Date getIssueInstant() {
- return wrapStoredObject(VALUE_ISSUEINSTANT, null, Date.class);
+ public Instant getIssueInstant() {
+ return wrapStoredObject(VALUE_ISSUEINSTANT, null, Instant.class);
}
/*
@@ -67,7 +69,7 @@ public class AuthProcessDataWrapper
@Override
public String getIssueInstantString() {
return buildDateTimeUtcString(
- wrapStoredObject(VALUE_ISSUEINSTANT, null, Date.class));
+ wrapStoredObject(VALUE_ISSUEINSTANT, null, Instant.class));
}
/*
@@ -92,7 +94,7 @@ public class AuthProcessDataWrapper
* java.lang.String)
*/
@Override
- public void setIssueInstant(final Date issueInstant) {
+ public void setIssueInstant(final Instant issueInstant) {
authProcessData.put(VALUE_ISSUEINSTANT, issueInstant);
}
@@ -347,16 +349,17 @@ public class AuthProcessDataWrapper
* <code>yyyy-MM-dd'T'HH:mm:ss'Z'</code>, or <code>null</code> if {@link Date} was <code>null</code>
*/
@Nullable
- public static String buildDateTimeUtcString(@Nullable final Date date) {
+ public static String buildDateTimeUtcString(@Nullable final Instant date) {
if (date == null) {
return null;
}
-
- final SimpleDateFormat f = new SimpleDateFormat(PATTERN_ISSUE_INSTANT);
- f.setTimeZone(TimeZone.getTimeZone("UTC"));
- return f.format(date.getTime());
-
+
+ return DateTimeFormatter
+ .ofPattern(PATTERN_ISSUE_INSTANT)
+ .withZone(ZoneId.of("UTC"))
+ .format(date);
+
}
/**
@@ -368,11 +371,11 @@ public class AuthProcessDataWrapper
* if input parameter was <code>null</code> or invalid
*/
@Nullable
- public static Date buildDateTimeUtcDate(@Nullable final String date) {
+ public static Instant buildDateTimeUtcDate(@Nullable final String date) {
final SimpleDateFormat f = new SimpleDateFormat(PATTERN_ISSUE_INSTANT);
try {
- if (date != null) {
- return f.parse(date);
+ if (date != null) {
+ return f.parse(date).toInstant();
}