[58] | 1 | /* Copyright 2006-2009 the original author or authors. |
---|
| 2 | * |
---|
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | * you may not use this file except in compliance with the License. |
---|
| 5 | * You may obtain a copy of the License at |
---|
| 6 | * |
---|
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | * |
---|
| 9 | * Unless required by applicable law or agreed to in writing, software |
---|
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | * See the License for the specific language governing permissions and |
---|
| 13 | * limitations under the License. |
---|
| 14 | */ |
---|
| 15 | package org.codehaus.groovy.grails.plugins.springsecurity.openid |
---|
| 16 | |
---|
| 17 | import org.springframework.security.GrantedAuthority |
---|
| 18 | import org.springframework.security.providers.openid.OpenIDAuthenticationStatus |
---|
| 19 | import org.springframework.security.providers.openid.OpenIDAuthenticationToken |
---|
| 20 | import org.springframework.security.userdetails.UserDetails |
---|
| 21 | |
---|
| 22 | /** |
---|
| 23 | * Subclass that holds the user domain instance. |
---|
| 24 | * |
---|
| 25 | * @author <a href='mailto:beckwithb@studentsonly.com'>Burt Beckwith</a> |
---|
| 26 | */ |
---|
| 27 | class GrailsOpenIdAuthenticationToken extends OpenIDAuthenticationToken { |
---|
| 28 | |
---|
| 29 | private UserDetails _userDetails |
---|
| 30 | |
---|
| 31 | /** |
---|
| 32 | * Full constructor. |
---|
| 33 | * @param userDetails the details |
---|
| 34 | * @param status the status |
---|
| 35 | * @param identityUrl the url |
---|
| 36 | */ |
---|
| 37 | GrailsOpenIdAuthenticationToken( |
---|
| 38 | UserDetails userDetails, |
---|
| 39 | OpenIDAuthenticationStatus status, |
---|
| 40 | String identityUrl) { |
---|
| 41 | super(userDetails.authorities, status, identityUrl) |
---|
| 42 | _userDetails = userDetails |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | /** |
---|
| 46 | * {@inheritDoc} |
---|
| 47 | * @see org.springframework.security.providers.openid.OpenIDAuthenticationToken#getPrincipal() |
---|
| 48 | */ |
---|
| 49 | @Override |
---|
| 50 | Object getPrincipal() { |
---|
| 51 | return _userDetails |
---|
| 52 | } |
---|
| 53 | } |
---|