mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-18 03:41:09 +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
|
// Redirect with JWT Token
|
||||||
String redirectUri = (String) req.getSession().getAttribute(SESSION_REDIRECT_URI);
|
String redirectUri = (String) req.getSession().getAttribute(SESSION_REDIRECT_URI);
|
||||||
String url =
|
String url =
|
||||||
redirectUri
|
String.format(
|
||||||
+ "?id_token="
|
"%s?id_token=%s&email=%s&name=%s",
|
||||||
+ jwtAuthMechanism.getJWTToken()
|
(nullOrEmpty(redirectUri) ? buildBaseRequestUrl(req) : redirectUri),
|
||||||
+ "&email="
|
jwtAuthMechanism.getJWTToken(),
|
||||||
+ nameId
|
nameId,
|
||||||
+ "&name="
|
username);
|
||||||
+ username;
|
|
||||||
resp.sendRedirect(url);
|
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(
|
private JwtResponse getJwtResponseWithRefresh(
|
||||||
User storedUser, JWTAuthMechanism jwtAuthMechanism) {
|
User storedUser, JWTAuthMechanism jwtAuthMechanism) {
|
||||||
RefreshToken newRefreshToken = TokenUtil.getRefreshToken(storedUser.getId(), UUID.randomUUID());
|
RefreshToken newRefreshToken = TokenUtil.getRefreshToken(storedUser.getId(), UUID.randomUUID());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user