Coverage Report - org.mule.extras.jaas.JaasAuthentication
 
Classes in this File Line Coverage Branch Coverage Complexity
JaasAuthentication
78%
14/18
N/A
1
 
 1  
 /*
 2  
  * $Id: JaasAuthentication.java 8467 2007-09-18 11:44:20Z marie.rizzo $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.extras.jaas;
 12  
 
 13  
 import org.mule.umo.security.UMOAuthentication;
 14  
 import org.mule.umo.security.UMOCredentials;
 15  
 
 16  
 import java.util.Map;
 17  
 
 18  
 import javax.security.auth.Subject;
 19  
 
 20  
 public class JaasAuthentication implements UMOAuthentication
 21  
 {
 22  
     private boolean authenticated;
 23  
     private char[] credentials;
 24  
     private String user;
 25  
     private Map properties;
 26  
     private Subject subject;
 27  
   
 28  
     public JaasAuthentication(UMOCredentials credentials)
 29  20
     {
 30  20
         this.user = credentials.getUsername();
 31  20
         this.credentials = credentials.getPassword();
 32  20
     }
 33  
     
 34  
     public JaasAuthentication(Object user, Object credentials, Subject subject)
 35  8
     {
 36  8
         this.user = (String) user;
 37  8
         this.credentials = ((String) credentials).toCharArray();
 38  8
         this.subject = subject;
 39  8
     }
 40  
 
 41  
     public void setAuthenticated(boolean b)
 42  
     {
 43  8
         authenticated = b;
 44  8
     }
 45  
 
 46  
     public boolean isAuthenticated()
 47  
     {
 48  0
         return authenticated;
 49  
     }
 50  
 
 51  
     public Object getCredentials()
 52  
     {
 53  28
         return new String(credentials);
 54  
     }
 55  
 
 56  
     public Object getPrincipal()
 57  
     {
 58  40
         return user;
 59  
     }
 60  
 
 61  
     public Map getProperties()
 62  
     {
 63  0
         return properties;
 64  
     }
 65  
 
 66  
     public void setProperties(Map properties)
 67  
     {
 68  0
         this.properties = properties;
 69  0
     }
 70  
 
 71  
     public Subject getSubject()
 72  
     {
 73  20
         return subject;
 74  
     }
 75  
 }