- Timestamp:
- Oct 22, 2010, 4:18:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/authentication/LoginController.groovy
r976 r983 24 24 */ 25 25 def springSecurityService 26 27 /** 28 * Dependency injection for the GSCF authentication service 29 */ 30 def AuthenticationService 26 31 27 32 /** … … 55 60 } 56 61 62 /** 63 * Shows the login page for users from a module 64 */ 65 def auth_remote = { 66 def consumer = params.consumer 67 def token = params.token 68 69 if( consumer == null || token == null ) { 70 throw new Exception( "Consumer and Token must be given!" ); 71 } 72 73 def returnUrl = params.returnUrl 74 75 // If the user is already authenticated with this session_id, redirect 76 // him 77 if( AuthenticationService.isRemotelyLoggedIn( consumer, token ) ) { 78 if( returnUrl ) { 79 redirect url: returnUrl 80 } else { 81 redirect controller: 'home' 82 } 83 } 84 85 // If the user is already logged in locally, we log him in and 86 // immediately redirect him 87 if (AuthenticationService.isLoggedIn()) { 88 AuthenticationService.logInRemotely( consumer, token, AuthenticationService.getLoggedInUser() ) 89 90 if( returnUrl ) { 91 redirect url: returnUrl 92 } else { 93 redirect controller: 'home' 94 } 95 } 96 97 // Otherwise we show the login screen 98 def config = SpringSecurityUtils.securityConfig 99 String view = 'auth' 100 String postUrl = "${request.contextPath}${config.apf.filterProcessesUrl}" 101 String redirectUrl = g.createLink( absolute: true, controller: 'login', action: 'auth_remote', params: [ consumer: params.consumer, token: params.token, returnUrl: params.returnUrl ] ) 102 render view: view, model: [postUrl: postUrl, 103 rememberMeParameter: config.rememberMe.parameter, redirectUrl: redirectUrl ] 104 } 105 57 106 /** 58 107 * Show denied page.
Note: See TracChangeset
for help on using the changeset viewer.