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: 78   Methods: 6
NCLOC: 32   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AuthenticationTrustResolverImpl.java 75% 90% 100% 90%
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;
 17   
 18    import org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken;
 19    import org.acegisecurity.providers.rememberme.RememberMeAuthenticationToken;
 20   
 21   
 22    /**
 23    * Basic implementation of {@link AuthenticationTrustResolver}.
 24    *
 25    * <p>
 26    * Makes trust decisions based on whether the passed
 27    * <code>Authentication</code> is an instance of a defined class.
 28    * </p>
 29    *
 30    * <p>
 31    * If {@link #anonymousClass} or {@link #rememberMeClass} is <code>null</code>,
 32    * the corresponding method will always return <code>false</code>.
 33    * </p>
 34    *
 35    * @author Ben Alex
 36    * @version $Id: AuthenticationTrustResolverImpl.java,v 1.4 2005/11/17 00:55:49 benalex Exp $
 37    */
 38    public class AuthenticationTrustResolverImpl
 39    implements AuthenticationTrustResolver {
 40    //~ Instance fields ========================================================
 41   
 42    private Class anonymousClass = AnonymousAuthenticationToken.class;
 43    private Class rememberMeClass = RememberMeAuthenticationToken.class;
 44   
 45    //~ Methods ================================================================
 46   
 47  32 public boolean isAnonymous(Authentication authentication) {
 48  32 if ((anonymousClass == null) || (authentication == null)) {
 49  4 return false;
 50    }
 51   
 52  28 return anonymousClass.isAssignableFrom(authentication.getClass());
 53    }
 54   
 55  1 public void setAnonymousClass(Class anonymousClass) {
 56  1 this.anonymousClass = anonymousClass;
 57    }
 58   
 59  2 public Class getAnonymousClass() {
 60  2 return anonymousClass;
 61    }
 62   
 63  10 public boolean isRememberMe(Authentication authentication) {
 64  10 if ((rememberMeClass == null) || (authentication == null)) {
 65  0 return false;
 66    }
 67   
 68  10 return rememberMeClass.isAssignableFrom(authentication.getClass());
 69    }
 70   
 71  1 public void setRememberMeClass(Class rememberMeClass) {
 72  1 this.rememberMeClass = rememberMeClass;
 73    }
 74   
 75  2 public Class getRememberMeClass() {
 76  2 return rememberMeClass;
 77    }
 78    }