mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-03 03:59:12 +00:00
[Fix-19437] Redirection issue on IDP initiated calls (#19443)
Co-authored-by: Siddhant <86899184+Siddhanttimeline@users.noreply.github.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> (cherry picked from commit 5064602dc8228cfd0c60b31f07d6447851f8a226)
This commit is contained in:
parent
c194631488
commit
8ae94f598b
@ -130,17 +130,22 @@ public class SamlAssertionConsumerServlet extends HttpServlet {
|
||||
// Redirect with JWT Token
|
||||
String redirectUri = (String) req.getSession().getAttribute(SESSION_REDIRECT_URI);
|
||||
String url =
|
||||
redirectUri
|
||||
+ "?id_token="
|
||||
+ jwtAuthMechanism.getJWTToken()
|
||||
+ "&email="
|
||||
+ nameId
|
||||
+ "&name="
|
||||
+ username;
|
||||
String.format(
|
||||
"%s?id_token=%s&email=%s&name=%s",
|
||||
(nullOrEmpty(redirectUri) ? buildBaseRequestUrl(req) : redirectUri),
|
||||
jwtAuthMechanism.getJWTToken(),
|
||||
nameId,
|
||||
username);
|
||||
resp.sendRedirect(url);
|
||||
}
|
||||
}
|
||||
|
||||
private String buildBaseRequestUrl(HttpServletRequest req) {
|
||||
// In case of IDP initiated one it needs to be built on fly, since the session might not exist
|
||||
return String.format(
|
||||
"%s://%s:%s/saml/callback", req.getScheme(), req.getServerName(), req.getServerPort());
|
||||
}
|
||||
|
||||
private JwtResponse getJwtResponseWithRefresh(
|
||||
User storedUser, JWTAuthMechanism jwtAuthMechanism) {
|
||||
RefreshToken newRefreshToken = TokenUtil.getRefreshToken(storedUser.getId(), UUID.randomUUID());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user