| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
| CasAuthoritiesPopulator |
|
| 1.0;1 |
| 1 | /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited |
|
| 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 | ||
| 16 | package org.acegisecurity.providers.cas; |
|
| 17 | ||
| 18 | import org.acegisecurity.AuthenticationException; |
|
| 19 | ||
| 20 | import org.acegisecurity.userdetails.UserDetails; |
|
| 21 | ||
| 22 | ||
| 23 | /** |
|
| 24 | * Populates the <code>UserDetails</code> associated with a CAS authenticated |
|
| 25 | * user. |
|
| 26 | * |
|
| 27 | * <p> |
|
| 28 | * CAS does not provide the authorities (roles) granted to a user. It merely |
|
| 29 | * authenticates their identity. As the Acegi Security System for Spring needs |
|
| 30 | * to know the authorities granted to a user in order to construct a valid |
|
| 31 | * <code>Authentication</code> object, implementations of this interface will |
|
| 32 | * provide this information. |
|
| 33 | * </p> |
|
| 34 | * |
|
| 35 | * <p> |
|
| 36 | * A {@link UserDetails} is returned by implementations. The |
|
| 37 | * <code>UserDetails</code> must, at minimum, contain the username and |
|
| 38 | * <code>GrantedAuthority[]</code> objects applicable to the CAS-authenticated |
|
| 39 | * user. Note that Acegi Security ignores the password and enabled/disabled |
|
| 40 | * status of the <code>UserDetails</code> because this is |
|
| 41 | * authentication-related and should have been enforced by the CAS server. The |
|
| 42 | * <code>UserDetails</code> returned by implementations is stored in the |
|
| 43 | * generated <code>CasAuthenticationToken</code>, so additional properties |
|
| 44 | * such as email addresses, telephone numbers etc can easily be stored. |
|
| 45 | * </p> |
|
| 46 | * |
|
| 47 | * <p> |
|
| 48 | * Implementations should not perform any caching. They will only be called |
|
| 49 | * when a refresh is required. |
|
| 50 | * </p> |
|
| 51 | * |
|
| 52 | * @author Ben Alex |
|
| 53 | * @version $Id: CasAuthoritiesPopulator.java 1784 2007-02-24 21:00:24Z luke_t $ |
|
| 54 | */ |
|
| 55 | public interface CasAuthoritiesPopulator { |
|
| 56 | //~ Methods ======================================================================================================== |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Obtains the granted authorities for the specified user.<P>May throw any |
|
| 60 | * <code>AuthenticationException</code> or return <code>null</code> if the authorities are unavailable.</p> |
|
| 61 | * |
|
| 62 | * @param casUserId as obtained from the CAS validation service |
|
| 63 | * |
|
| 64 | * @return the details of the indicated user (at minimum the granted authorities and the username) |
|
| 65 | * |
|
| 66 | * @throws AuthenticationException DOCUMENT ME! |
|
| 67 | */ |
|
| 68 | UserDetails getUserDetails(String casUserId) |
|
| 69 | throws AuthenticationException; |
|
| 70 | } |