Skip to content

Commit a99795d

Browse files
nury-garryyevLEDfan
authored andcommitted
SAML logout generic solution
1 parent bc1fed7 commit a99795d

File tree

4 files changed

+51
-4
lines changed

4 files changed

+51
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/target/
22
application.yml
33
logs
4+
5+
.idea
6+
*.iml

src/main/java/eu/openanalytics/containerproxy/auth/impl/SAMLAuthenticationBackend.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ public void configureHttpSecurity(HttpSecurity http, AuthorizedUrl anyRequestCon
7979
.addFilterBefore(metadataGeneratorFilter, ChannelProcessingFilter.class)
8080
.addFilterAfter(metadataDisplayFilter, MetadataGeneratorFilter.class)
8181
.addFilterAfter(samlFilter, BasicAuthenticationFilter.class);
82-
http
83-
.logout()
84-
.disable();
8582
}
8683

8784
@Override

src/main/java/eu/openanalytics/containerproxy/security/WebSecurityConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected void configure(HttpSecurity http) throws Exception {
135135
.loginPage("/login")
136136
.and()
137137
.logout()
138-
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
138+
.logoutRequestMatcher(new AntPathRequestMatcher("/simple/logout"))
139139
.addLogoutHandler(logoutHandler)
140140
.logoutSuccessUrl(auth.getLogoutSuccessURL());
141141

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* ContainerProxy
3+
*
4+
* Copyright (C) 2016-2020 Open Analytics
5+
*
6+
* ===========================================================================
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the Apache License as published by
10+
* The Apache Software Foundation, either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* Apache License for more details.
17+
*
18+
* You should have received a copy of the Apache License
19+
* along with this program. If not, see <http://www.apache.org/licenses/>
20+
*/
21+
package eu.openanalytics.containerproxy.ui;
22+
23+
import eu.openanalytics.containerproxy.api.BaseController;
24+
import eu.openanalytics.containerproxy.auth.IAuthenticationBackend;
25+
import eu.openanalytics.containerproxy.auth.impl.SAMLAuthenticationBackend;
26+
27+
import org.springframework.stereotype.Controller;
28+
import org.springframework.web.bind.annotation.RequestMapping;
29+
import org.springframework.web.bind.annotation.RequestMethod;
30+
31+
import javax.inject.Inject;
32+
33+
@Controller
34+
public class LogoutController extends BaseController {
35+
36+
@Inject
37+
private IAuthenticationBackend auth;
38+
39+
@RequestMapping(value = "/logout", method = RequestMethod.GET)
40+
public String logout() {
41+
if (auth instanceof SAMLAuthenticationBackend) {
42+
return "redirect:/saml/logout";
43+
} else {
44+
return "redirect:/simple/logout";
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)