Add login and logout paths to config
This commit is contained in:
@@ -165,16 +165,16 @@ public class CloudfoundrySsoConfiguration {
|
||||
requests.anyRequest().authenticated();
|
||||
}
|
||||
|
||||
http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
|
||||
http.logout().logoutRequestMatcher(new AntPathRequestMatcher(sso.getLogoutPath()))
|
||||
.addLogoutHandler(logoutHandler());
|
||||
http.exceptionHandling().authenticationEntryPoint(
|
||||
new LoginUrlAuthenticationEntryPoint("/login"));
|
||||
new LoginUrlAuthenticationEntryPoint(sso.getLoginPath()));
|
||||
|
||||
}
|
||||
|
||||
protected OAuth2ClientAuthenticationProcessingFilter cloudfoundrySsoFilter() {
|
||||
OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(
|
||||
"/login");
|
||||
sso.getLoginPath());
|
||||
filter.setRestTemplate(restTemplate);
|
||||
filter.setTokenServices(tokenServices());
|
||||
return filter;
|
||||
@@ -195,7 +195,7 @@ public class CloudfoundrySsoConfiguration {
|
||||
HttpServletResponse response, Authentication authentication) {
|
||||
restTemplate.getOAuth2ClientContext().setAccessToken(null);
|
||||
String redirect = request.getRequestURL().toString()
|
||||
.replace("/logout", sso.getHome().getPath());
|
||||
.replace(sso.getLogoutPath(), sso.getHome().getPath());
|
||||
try {
|
||||
response.sendRedirect(sso.getLogoutUri(redirect));
|
||||
}
|
||||
|
||||
@@ -31,19 +31,28 @@ import org.springframework.validation.Validator;
|
||||
@Data
|
||||
public class CloudfoundrySsoProperties implements Validator {
|
||||
|
||||
@Value("${vcap.services.sso.credentials.tokenUri:}")
|
||||
private String serviceId = "sso";
|
||||
|
||||
private String logoutPath = "/logout";
|
||||
|
||||
private String loginPath = "/login";
|
||||
|
||||
@Value("${vcap.services.${cloudfoundry.sso.serviceId:sso}.credentials.tokenUri:}")
|
||||
private String tokenUri;
|
||||
|
||||
@Value("${vcap.services.sso.credentials.tokenInfoUri:}")
|
||||
@Value("${vcap.services.${cloudfoundry.sso.serviceId:sso}.credentials.userInfoUri:}")
|
||||
private String userInfoUri;
|
||||
|
||||
@Value("${vcap.services.${cloudfoundry.sso.serviceId:sso}.credentials.tokenInfoUri:}")
|
||||
private String tokenInfoUri;
|
||||
|
||||
@Value("${vcap.services.sso.credentials.authorizationUri:}")
|
||||
@Value("${vcap.services.${cloudfoundry.sso.serviceId:sso}.credentials.authorizationUri:}")
|
||||
private String authorizationUri;
|
||||
|
||||
@Value("${vcap.services.sso.credentials.clientId:}")
|
||||
@Value("${vcap.services.${cloudfoundry.sso.serviceId:sso}.credentials.clientId:}")
|
||||
private String clientId;
|
||||
|
||||
@Value("${vcap.services.sso.credentials.clientSecret:}")
|
||||
@Value("${vcap.services.${cloudfoundry.sso.serviceId:sso}.credentials.clientSecret:}")
|
||||
private String clientSecret;
|
||||
|
||||
private Home home = new Home();
|
||||
|
||||
Reference in New Issue
Block a user