Set authenticated time in auth result
@@ -301,7 +301,7 @@ public class DefaultAuthenticationRequestHandler implements AuthenticationReques
SessionContext sessionContext = null;
String commonAuthCookie = null;
String sessionContextKey = null;
- if (FrameworkUtils.getAuthCookie(request) != null) {
+ if (FrameworkUtils.getAuthCookie(request) != null && !context.isForceAuthenticate()) {
commonAuthCookie = FrameworkUtils.getAuthCookie(request).getValue();
@@ -345,6 +345,11 @@ public class DefaultAuthenticationRequestHandler implements AuthenticationReques
}
}
+ Long createdTime = (Long)sessionContext.getProperty(FrameworkConstants.CREATED_TIMESTAMP);
+ if (createdTime != null) {
+ authenticationResult.addProperty(FrameworkConstants.CREATED_TIMESTAMP, createdTime);
+ }
+
// Authentication context properties received from newly authenticated IdPs
if (context.getProperty(FrameworkConstants.AUTHENTICATION_CONTEXT_PROPERTIES) != null) {
authenticationContextProperties.addAll((List<AuthenticationContextProperty>) context
@@ -398,7 +403,9 @@ public class DefaultAuthenticationRequestHandler implements AuthenticationReques
String sessionKey = UUIDGenerator.generateUUID();
sessionContextKey = DigestUtils.sha256Hex(sessionKey);
sessionContext.addProperty(FrameworkConstants.AUTHENTICATED_USER, authenticationResult.getSubject());
- sessionContext.addProperty(FrameworkConstants.CREATED_TIMESTAMP, System.currentTimeMillis());
+ Long createdTimeMillis = System.currentTimeMillis();
+ sessionContext.addProperty(FrameworkConstants.CREATED_TIMESTAMP, createdTimeMillis);
+ authenticationResult.addProperty(FrameworkConstants.CREATED_TIMESTAMP, createdTimeMillis);
sessionContext.getSessionAuthHistory().resetHistory(
AuthHistory.merge(sessionContext.getSessionAuthHistory().getHistory(),
context.getAuthenticationStepHistory()));
