Skip to content

Commit

Permalink
Add logging for token introspection and user activity check
Browse files Browse the repository at this point in the history
Additional logging has been inserted into the OktaOAuthAuthenticationService class. The log records token introspection response and a new check is also implemented to ensure user activity, logging failure if the user is not active.
  • Loading branch information
Gcolon021 committed Jan 22, 2024
1 parent 43099eb commit 8e6a6a9
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public Response authenticate(UriInfo uriInfo, Map<String, String> authRequest) {
return PICSUREResponse.error("Failed to introspect access token.");
}

logger.info("Introspection Token: " + introspectResponse);

User user = initializeUser(introspectResponse);
if (user == null) {
logger.info("LOGIN FAILED ___ USER NOT FOUND ___ " + userToken.get("email").asText() + ":" + userToken.get("sub").asText() + " ___");
Expand All @@ -72,6 +74,12 @@ public Response authenticate(UriInfo uriInfo, Map<String, String> authRequest) {
}

private User initializeUser(JsonNode introspectResponse) {
boolean isActive = introspectResponse.get("active").asBoolean();
if (!isActive) {
logger.info("LOGIN FAILED ___ USER IS NOT ACTIVE ___ ");
return null;
}

User user = loadUser(introspectResponse);
clearCache(user);
user = addUserRoles(user);
Expand Down

0 comments on commit 8e6a6a9

Please sign in to comment.