Clover coverage report - Acegi Security System for Spring - 1.0.0-RC1
Coverage timestamp: Mon Dec 5 2005 09:05:15 EST
file stats: LOC: 69   Methods: 5
NCLOC: 31   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PrincipalAcegiUserToken.java 50% 90% 100% 88.2%
coverage coverage
 1    /* Copyright 2004, 2005 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.adapters;
 17   
 18    import org.acegisecurity.GrantedAuthority;
 19   
 20    import java.security.Principal;
 21   
 22   
 23    /**
 24    * A {@link Principal} compatible {@link org.acegisecurity.Authentication}
 25    * object.
 26    *
 27    * @author Ben Alex
 28    * @version $Id: PrincipalAcegiUserToken.java,v 1.6 2005/11/25 00:26:30 benalex Exp $
 29    */
 30    public class PrincipalAcegiUserToken extends AbstractAdapterAuthenticationToken
 31    implements Principal {
 32    //~ Instance fields ========================================================
 33   
 34    private Object principal;
 35    private String password;
 36    private String username;
 37   
 38    //~ Constructors ===========================================================
 39   
 40  9 public PrincipalAcegiUserToken(String key, String username,
 41    String password, GrantedAuthority[] authorities, Object principal) {
 42  9 super(key, authorities);
 43  9 this.username = username;
 44  9 this.password = password;
 45  9 this.principal = principal;
 46    }
 47   
 48  1 protected PrincipalAcegiUserToken() {
 49  1 throw new IllegalArgumentException("Cannot use default constructor");
 50    }
 51   
 52    //~ Methods ================================================================
 53   
 54  15 public Object getCredentials() {
 55  15 return this.password;
 56    }
 57   
 58  3 public String getName() {
 59  3 return this.username;
 60    }
 61   
 62  15 public Object getPrincipal() {
 63  15 if (this.principal == null) {
 64  15 return this.username;
 65    }
 66   
 67  0 return this.principal;
 68    }
 69    }