Skip to content

Commit

Permalink
Catching PA token validation error (finos#760)
Browse files Browse the repository at this point in the history
* Catching PA token validation error

* Update PA token validation logging

Co-authored-by: Kevin Knight <[email protected]>

---------

Co-authored-by: Kevin Knight <[email protected]>
  • Loading branch information
ivan-kyosev-gs and kevin-m-knight-gs authored Mar 4, 2024
1 parent 83b2df6 commit 3071184
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,17 @@ public static Session getSessionUsingGitlabPersonalAccessToken(HttpServletReques
GitlabPersonalAccessTokenProfileCreator creator = new GitlabPersonalAccessTokenProfileCreator(client.host);
GitlabPersonalAccessTokenAuthenticator authenticator = new GitlabPersonalAccessTokenAuthenticator(client.scheme, client.host, client.apiVersion);
GitlabPersonalAccessTokenCredentials credentials = extractor.extract(context);
authenticator.validate(credentials, context);

try
{
authenticator.validate(credentials, context);
}
catch (Exception e)
{
LOGGER.error("Validation failed for PA token", e);
return null;
}

GitlabPersonalAccessTokenProfile profile = creator.create(credentials, context);
return GitLabSessionBuilder.newBuilder(appInfo).withProfile(profile).build();
}
Expand Down

0 comments on commit 3071184

Please sign in to comment.