Skip to content

Commit a22a5e9

Browse files
committed
Merge branch 'feature/fix-callback-authorize-url' into develop
2 parents 2bdcaab + b92b0cb commit a22a5e9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/main/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20CallbackAuthorizeEndpointController.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ public ModelAndView handleRequest(final HttpServletRequest request, final HttpSe
5858

5959
val callback = new OAuth20CallbackLogic();
6060
val context = new JEEContext(request, response, getOAuthConfigurationContext().getSessionStore());
61+
// Build the request URL with server prefix "https://accounts.osf.io" instead of calling `context.getFullRequestURL()` which
62+
// somehow uses "https://127.0.0.1". This is a work-around for a weird tomcat relative redirect issue on staging 1 and prod.
63+
val serverPrefix = getOAuthConfigurationContext().getCasProperties().getServer().getPrefix();
64+
val fullRequestUrl = serverPrefix + request.getRequestURI() + '?' + request.getQueryString();
6165
callback.perform(
6266
context,
6367
getOAuthConfigurationContext().getOauthConfig(), (object, ctx) -> Boolean.FALSE,
64-
context.getFullRequestURL(),
68+
fullRequestUrl,
6569
Boolean.TRUE,
6670
Boolean.FALSE,
6771
Boolean.FALSE,
@@ -76,7 +80,7 @@ public ModelAndView handleRequest(final HttpServletRequest request, final HttpSe
7680
return OsfCasOAuth20Utils.produceOAuth20ErrorView(modelContext);
7781
}
7882
val manager = new ProfileManager<>(context, context.getSessionStore());
79-
LOGGER.trace("OAuth callback URL is [{}]", url);
83+
LOGGER.debug("OAuth callback URL is [{}]", url);
8084
return getOAuthConfigurationContext().getCallbackAuthorizeViewResolver().resolve(context, manager, url);
8185
}
8286

0 commit comments

Comments
 (0)