Skip to content

Commit 9bbfb63

Browse files
committed
fix(oidc): redirect auth failures to styled login page
OIDC failures were redirecting to /login?error (Spring Boot's auto-generated page) instead of /login.html?error. Adding failureUrl to the oauth2Login config fixes the redirect. Also generalized the error message copy to make sense for both form login and OIDC failures.
1 parent 9a5b399 commit 9bbfb63

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

git-proxy-java-dashboard/src/main/java/org/finos/gitproxy/dashboard/SecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ private void configureOidcAuth(
410410
oauth2.clientRegistrationRepository(new InMemoryClientRegistrationRepository(registration))
411411
.authorizedClientRepository(new HttpSessionOAuth2AuthorizedClientRepository())
412412
.successHandler(successHandler)
413+
.failureUrl("/login.html?error")
413414
.userInfoEndpoint(userInfo ->
414415
userInfo.oidcUserService(buildOidcUserService(roleMappings, groupsClaim)));
415416

git-proxy-java-dashboard/src/main/resources/static/login.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h2 class="text-lg font-semibold text-gray-800 mb-6">Sign in</h2>
2727
You have been signed out.
2828
</div>
2929
<div id="msg-error" class="hidden mb-4 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-3 py-2">
30-
Invalid username or password.
30+
Sign in failed. Check your credentials or contact your administrator.
3131
</div>
3232

3333
<form id="login-form" method="post" action="/login" class="space-y-4">

0 commit comments

Comments
 (0)