Skip to content

Commit

Permalink
Merge pull request #22 from atlanhq/PLT-865-token-exchange-update
Browse files Browse the repository at this point in the history
[REMOVE] logs added for debugging
  • Loading branch information
JhaSwechha authored Mar 12, 2024
2 parents 18694fe + 9c1f6f9 commit 8d6a53e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import javax.ws.rs.client.WebTarget;

import org.jboss.logging.Logger;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
import org.keycloak.admin.client.Config;
Expand All @@ -45,7 +44,6 @@
*/
public class TokenManager {
private static final long DEFAULT_MIN_VALIDITY = 30;
private static final Logger logger = Logger.getLogger(TokenManager.class);
private AccessTokenResponse currentToken;
private long expirationTime;
private long refreshExpirationTime;
Expand Down Expand Up @@ -82,7 +80,6 @@ public synchronized AccessTokenResponse getAccessToken() {
}

public AccessTokenResponse grantToken() {
logger.error("Inside grant token change in token manager");
Form form = new Form().param(GRANT_TYPE, accessTokenGrantType);
if (PASSWORD.equals(accessTokenGrantType)) {
form.param(USERNAME, config.getUsername())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@ public void close() {
}

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,10 +195,8 @@ 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,7 +172,6 @@ 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 8d6a53e

Please sign in to comment.