Coverage Report - org.kuali.rice.kim.client.acegi.LdapUserDetailsService
 
Classes in this File Line Coverage Branch Coverage Complexity
LdapUserDetailsService
0%
0/13
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kim.client.acegi;
 17  
 
 18  
 import org.acegisecurity.GrantedAuthority;
 19  
 import org.acegisecurity.ldap.LdapUserSearch;
 20  
 import org.acegisecurity.providers.ldap.LdapAuthoritiesPopulator;
 21  
 import org.acegisecurity.userdetails.User;
 22  
 import org.acegisecurity.userdetails.UserDetails;
 23  
 import org.acegisecurity.userdetails.UserDetailsService;
 24  
 import org.acegisecurity.userdetails.ldap.LdapUserDetails;
 25  
 import org.springframework.beans.factory.InitializingBean;
 26  
 import org.springframework.util.Assert;
 27  
 
 28  0
 public class LdapUserDetailsService implements UserDetailsService, InitializingBean
 29  
 {
 30  
     LdapUserSearch           ldapUserSearch;
 31  
     LdapAuthoritiesPopulator ldapAuthoritiesPopulator;
 32  
 
 33  
     public void afterPropertiesSet() throws Exception
 34  
     {
 35  0
         Assert.notNull(this.ldapUserSearch, "An LDAP search object must be set");
 36  0
         Assert.notNull(this.ldapAuthoritiesPopulator, "An LDAP authorities populator must be set");
 37  0
     }
 38  
 
 39  
     public UserDetails loadUserByUsername(String username)
 40  
     {
 41  0
         LdapUserDetails ldapUserDetails = ldapUserSearch.searchForUser(username);
 42  0
         GrantedAuthority[] authorities = ldapAuthoritiesPopulator.getGrantedAuthorities(ldapUserDetails);
 43  
 
 44  0
         return new User(username, "empty_password", true, true, true, true, authorities);
 45  
     }
 46  
 
 47  
     public LdapAuthoritiesPopulator getLdapAuthoritiesPopulator()
 48  
     {
 49  0
         return ldapAuthoritiesPopulator;
 50  
     }
 51  
 
 52  
     public void setLdapAuthoritiesPopulator(LdapAuthoritiesPopulator ldapAuthoritiesPopulator)
 53  
     {
 54  0
         this.ldapAuthoritiesPopulator = ldapAuthoritiesPopulator;
 55  0
     }
 56  
 
 57  
     public LdapUserSearch getLdapUserSearch()
 58  
     {
 59  0
         return ldapUserSearch;
 60  
     }
 61  
 
 62  
     public void setLdapUserSearch(LdapUserSearch ldapUserSearch)
 63  
     {
 64  0
         this.ldapUserSearch = ldapUserSearch;
 65  0
     }
 66  
 }