Clover Coverage Report - Kuali Student 1.3.0-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Apr 28 2011 05:03:32 EDT
../../../../../../img/srcFileCovDistChart0.png 2% of files have more coverage
10   45   4   10
6   24   0.4   1
1     4  
1    
Warning
  • The source file used to generate this report was changed after Clover generated coverage information. The coverage reported may not match the source lines. You should regenerate the coverage information and the report to ensure the files are in sync.
 
  AuthenticationServiceImpl       Line # 26 10 0% 4 17 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2008-2009 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.service.impl;
17   
18    import javax.servlet.http.HttpServletRequest;
19   
20    import org.kuali.rice.kim.service.AuthenticationService;
21    import org.kuali.student.common.util.security.UserWithId;
22    import org.springframework.security.core.Authentication;
23    import org.springframework.security.core.context.SecurityContextHolder;
24    import org.springframework.security.core.userdetails.UserDetails;
25   
 
26    public class AuthenticationServiceImpl implements AuthenticationService {
27   
 
28  0 toggle public String getPrincipalName(HttpServletRequest request) {
29  0 String username=null;
30  0 Authentication auth = SecurityContextHolder.getContext().getAuthentication();
31   
32  0 if(auth!=null){
33  0 Object obj = auth.getPrincipal();
34  0 if(obj instanceof UserWithId){
35    //This is actually the user Id
36  0 username = ((UserWithId)obj).getUserId();
37  0 }else if (obj instanceof UserDetails) {
38  0 username = ((UserDetails)obj).getUsername();
39    } else {
40  0 username = request.getRemoteUser();
41    }
42    }
43  0 return username;
44    }
45    }