root/trunk/grails-app/controllers/dbnp/authentication/LogoutController.groovy @ 1588

Revision 1588, 1.6 KB (checked in by s.h.sikkema@…, 3 years ago)

Fixed tests (except webtests); cleaned up Example{Studies,Templates}.groovy; decapitalized injected services; made 'transactional' properties static

  • Property svn:keywords set to Rev Author Date
Line 
1package dbnp.authentication
2
3import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
4
5class LogoutController {
6        def authenticationService
7       
8        /**
9         * Index action. Redirects to the Spring security logout uri.
10         */
11        def index = {
12                if( params[ SpringSecurityUtils.securityConfig.successHandler.targetUrlParameter ] ) {
13                        redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl + "?" + SpringSecurityUtils.securityConfig.successHandler.targetUrlParameter + '=' + params[ SpringSecurityUtils.securityConfig.successHandler.targetUrlParameter ] // '/j_spring_security_logout'
14                } else {
15                        redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
16                }
17                // TODO  put any pre-logout code here
18               
19                // Remove all queries from session
20                session.queries = [];
21        }
22
23        def remote = {
24                if( params.consumer || params.token ) {
25                        // Log out the remote user
26                        authenticationService.logOffRemotely( params.consumer, params.token )
27                }
28               
29                // Try to rest the redirect url
30                if( params[ SpringSecurityUtils.securityConfig.successHandler.targetUrlParameter ] ) {
31                        redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl + "?" + SpringSecurityUtils.securityConfig.successHandler.targetUrlParameter + '=' + params[ SpringSecurityUtils.securityConfig.successHandler.targetUrlParameter ] // '/j_spring_security_logout'
32                } else {
33                        redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
34                }
35
36                // Remove all queries from session
37                session.queries = [];
38        }
39}
Note: See TracBrowser for help on using the browser.