root/resilient#9 Passou a redireccionar login SAML2 com sucesso para o
All checks were successful
Release / release (push) Successful in 21m21s
All checks were successful
Release / release (push) Successful in 21m21s
sucess-url, quando definido
This commit is contained in:
parent
7a69e6c491
commit
7cfc16e04d
1 changed files with 6 additions and 13 deletions
|
@ -162,21 +162,14 @@ public class Saml2AuthenticationHandler implements AuthenticationSuccessHandler,
|
||||||
userdetails.getAuthorities());
|
userdetails.getAuthorities());
|
||||||
SecurityContextHolder.getContext().setAuthentication(newAuthentication);
|
SecurityContextHolder.getContext().setAuthentication(newAuthentication);
|
||||||
|
|
||||||
// This is a sugar-code when in development environment.
|
// Send to success URL, if configured
|
||||||
if (isDevProfileActive()) {
|
|
||||||
// If this is a mock-idp, it can provide the parameter 'SAMLDevEnvironmentUrl'
|
|
||||||
// that gives the base URL to use. This is because in DEV mode usually the
|
|
||||||
// Angular side runs in localhost:42000 but server-side is in localhost:8080.
|
|
||||||
// Without this, SAMLv2 authentication would end up in error redirecting the user to
|
|
||||||
// localhost:8080 (NOT the client-side)
|
|
||||||
// In PROD we don't need this, because the app url is the same
|
|
||||||
String successUrl = resilientSaml2Properties.getSuccessUrl();
|
String successUrl = resilientSaml2Properties.getSuccessUrl();
|
||||||
|
|
||||||
if (successUrl != null && !successUrl.isBlank()) {
|
if (successUrl != null && !successUrl.isBlank()) {
|
||||||
|
// This is mandatory in DEV environment. Optional in PROD because the app url is the same.
|
||||||
|
// Even so, I think its a good practice to define the success url
|
||||||
response.sendRedirect(successUrl);
|
response.sendRedirect(successUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void invalidateLogin(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
private void invalidateLogin(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
// Clear context and invalidate session
|
// Clear context and invalidate session
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue