Coverage Report - org.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator
 
Classes in this File Line Coverage Branch Coverage Complexity
DaoCasAuthoritiesPopulator
100% 
N/A 
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.populator;
 17  
 
 18  
 import org.acegisecurity.AuthenticationException;
 19  
 
 20  
 import org.acegisecurity.providers.cas.CasAuthoritiesPopulator;
 21  
 
 22  
 import org.acegisecurity.userdetails.UserDetails;
 23  
 import org.acegisecurity.userdetails.UserDetailsService;
 24  
 
 25  
 import org.springframework.beans.factory.InitializingBean;
 26  
 
 27  
 import org.springframework.util.Assert;
 28  
 
 29  
 
 30  
 /**
 31  
  * Populates the CAS authorities via an {@link UserDetailsService}.<P>The additional information (username,
 32  
  * password, enabled status etc)  an <code>AuthenticationDao</code> implementation provides about  a <code>User</code>
 33  
  * is ignored. Only the <code>GrantedAuthority</code>s are relevant to this class.</p>
 34  
  *
 35  
  * @author Ben Alex
 36  
  * @version $Id: DaoCasAuthoritiesPopulator.java 1821 2007-05-17 03:18:35Z raykrueger $
 37  
  */
 38  5
 public class DaoCasAuthoritiesPopulator implements CasAuthoritiesPopulator, InitializingBean {
 39  
     //~ Instance fields ================================================================================================
 40  
 
 41  
     private UserDetailsService userDetailsService;
 42  
 
 43  
     //~ Methods ========================================================================================================
 44  
 
 45  
     public void afterPropertiesSet() throws Exception {
 46  4
         Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
 47  3
     }
 48  
 
 49  
     public UserDetails getUserDetails(String casUserId)
 50  
         throws AuthenticationException {
 51  3
         return this.userDetailsService.loadUserByUsername(casUserId);
 52  
     }
 53  
 
 54  
     public UserDetailsService getUserDetailsService() {
 55  1
         return userDetailsService;
 56  
     }
 57  
 
 58  
     public void setUserDetailsService(UserDetailsService userDetailsService) {
 59  4
         this.userDetailsService = userDetailsService;
 60  4
     }
 61  
 }