From 307118407367fb76be507461a51147352990d2be Mon Sep 17 00:00:00 2001 From: ivan-kyosev-gs <89931850+ivan-kyosev-gs@users.noreply.github.com> Date: Mon, 4 Mar 2024 17:11:14 +0000 Subject: [PATCH] Catching PA token validation error (#760) * Catching PA token validation error * Update PA token validation logging Co-authored-by: Kevin Knight <57677197+kevin-m-knight-gs@users.noreply.github.com> --------- Co-authored-by: Kevin Knight <57677197+kevin-m-knight-gs@users.noreply.github.com> --- .../legend/sdlc/server/tools/SessionProvider.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/tools/SessionProvider.java b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/tools/SessionProvider.java index 7bf71c62b7..dca714bfcc 100644 --- a/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/tools/SessionProvider.java +++ b/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/tools/SessionProvider.java @@ -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(); }