From bf9b572b835d37cc23b2c57437a3830a8ebf55f0 Mon Sep 17 00:00:00 2001 From: YuriyZ Date: Wed, 1 Jun 2022 15:36:38 +0300 Subject: [PATCH] feat(jans-auth-server): added sid and authn_time for active sessions response https://github.com/JanssenProject/jans/issues/1479 --- .../session/ws/rs/SessionRestWebService.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/jans-auth-server/server/src/main/java/io/jans/as/server/session/ws/rs/SessionRestWebService.java b/jans-auth-server/server/src/main/java/io/jans/as/server/session/ws/rs/SessionRestWebService.java index 1cf2d8e3059..ff1da7cb8f4 100644 --- a/jans-auth-server/server/src/main/java/io/jans/as/server/session/ws/rs/SessionRestWebService.java +++ b/jans-auth-server/server/src/main/java/io/jans/as/server/session/ws/rs/SessionRestWebService.java @@ -132,14 +132,25 @@ private JSONObject createJsonObject(SessionId sessionId) { final Date exp = sessionId.getExpirationDate(); final Date iat = sessionId.getCreationDate(); final Date lastUsedAt = sessionId.getLastUsedAt(); + final String sid = sessionId.getOutsideSid(); + final Date authnTime = sessionId.getAuthenticationTime(); JSONObject result = new JSONObject(); - if (lastUsedAt != null) - result.put("lastUsedAt", dateAsSeconds(lastUsedAt)); - if (iat != null) + if (lastUsedAt != null) { + result.put("last_used_at", dateAsSeconds(lastUsedAt)); + } + if (iat != null) { result.put("iat", dateAsSeconds(iat)); - if (exp != null) + } + if (exp != null) { result.put("exp", dateAsSeconds(exp)); + } + if (StringUtils.isNotBlank(sid)) { + result.put("sid", sid); + } + if (authnTime != null) { + result.put("authn_time", sid); + } return result; }