Skip to content

Commit

Permalink
Merge pull request #20 from atlanhq/PLT-865-token-exchange-update
Browse files Browse the repository at this point in the history
[ADD] logs to check token endpoint
  • Loading branch information
JhaSwechha authored Mar 8, 2024
2 parents 25c4f2d + d91e485 commit 240896a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected Response tokenExchange() {
UserModel tokenUser = null;
UserSessionModel tokenSession = null;
AccessToken token = null;

logger.error("Inside the token exchange method");
String subjectToken = formParams.getFirst(OAuth2Constants.SUBJECT_TOKEN);
if (subjectToken != null) {
String subjectTokenType = formParams.getFirst(OAuth2Constants.SUBJECT_TOKEN_TYPE);
Expand Down Expand Up @@ -197,12 +197,13 @@ protected Response tokenExchange() {

}

logger.error("Requested subject is " + requestedUser.getUsername() + " and enabled status is" + requestedUser.isEnabled());
if (!requestedUser.isEnabled()) {
// Return access denied for disabled user
logger.error("Requested subject is " + requestedUser.getUsername());
event.detail(Details.REASON, "requested_subject is disabled");
event.error(Errors.NOT_ALLOWED);
throw new CorsErrorResponseException(cors, OAuthErrorException.ACCESS_DENIED, "Client not allowed to exchange", Response.Status.FORBIDDEN);

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public TokenEndpoint(TokenManager tokenManager, RealmModel realm, EventBuilder e
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@POST
public Response processGrantRequest() {
logger.error("called the grant request here for access token");
cors = Cors.add(request).auth().allowedMethods("POST").auth().exposedHeaders(Cors.ACCESS_CONTROL_ALLOW_METHODS);

MultivaluedMap<String, String> formParameters = request.getDecodedFormParameters();
Expand Down

0 comments on commit 240896a

Please sign in to comment.