Skip to content

Commit

Permalink
SAML logout generic solution
Browse files Browse the repository at this point in the history
  • Loading branch information
nury-garryyev authored and LEDfan committed Jan 15, 2021
1 parent bc1fed7 commit a99795d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/target/
application.yml
logs

.idea
*.iml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ public void configureHttpSecurity(HttpSecurity http, AuthorizedUrl anyRequestCon
.addFilterBefore(metadataGeneratorFilter, ChannelProcessingFilter.class)
.addFilterAfter(metadataDisplayFilter, MetadataGeneratorFilter.class)
.addFilterAfter(samlFilter, BasicAuthenticationFilter.class);
http
.logout()
.disable();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected void configure(HttpSecurity http) throws Exception {
.loginPage("/login")
.and()
.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutRequestMatcher(new AntPathRequestMatcher("/simple/logout"))
.addLogoutHandler(logoutHandler)
.logoutSuccessUrl(auth.getLogoutSuccessURL());

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* ContainerProxy
*
* Copyright (C) 2016-2020 Open Analytics
*
* ===========================================================================
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Apache License as published by
* The Apache Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Apache License for more details.
*
* You should have received a copy of the Apache License
* along with this program. If not, see <http://www.apache.org/licenses/>
*/
package eu.openanalytics.containerproxy.ui;

import eu.openanalytics.containerproxy.api.BaseController;
import eu.openanalytics.containerproxy.auth.IAuthenticationBackend;
import eu.openanalytics.containerproxy.auth.impl.SAMLAuthenticationBackend;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.inject.Inject;

@Controller
public class LogoutController extends BaseController {

@Inject
private IAuthenticationBackend auth;

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout() {
if (auth instanceof SAMLAuthenticationBackend) {
return "redirect:/saml/logout";
} else {
return "redirect:/simple/logout";
}
}
}

0 comments on commit a99795d

Please sign in to comment.