Encode redirect URL before send it to AAI
This commit is contained in:
parent
8dbe961d55
commit
6e575ed4a6
|
@ -10,6 +10,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class OpenAIRELogoutSuccessHandler implements LogoutSuccessHandler {
|
public class OpenAIRELogoutSuccessHandler implements LogoutSuccessHandler {
|
||||||
|
@ -21,6 +24,10 @@ public class OpenAIRELogoutSuccessHandler implements LogoutSuccessHandler {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String encodeValue(String value) throws UnsupportedEncodingException {
|
||||||
|
return URLEncoder.encode(value, StandardCharsets.UTF_8.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
|
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
|
@ -30,6 +37,6 @@ public class OpenAIRELogoutSuccessHandler implements LogoutSuccessHandler {
|
||||||
redirect = properties.getRedirect();
|
redirect = properties.getRedirect();
|
||||||
}
|
}
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
response.sendRedirect(properties.getOidc().getLogout() + redirect);
|
response.sendRedirect(properties.getOidc().getLogout() + encodeValue(redirect));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue