View Javadoc

1   /*
2    * $Id: DefaultMuleAuthentication.java 10489 2008-01-23 17:53:38Z dfeist $
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.security;
12  
13  import org.mule.api.security.Authentication;
14  import org.mule.api.security.Credentials;
15  
16  import java.util.Map;
17  
18  public class DefaultMuleAuthentication implements Authentication
19  {
20      private boolean authenticated;
21      private char[] credentials;
22      private String user;
23      private Map properties;
24  
25      public DefaultMuleAuthentication(Credentials credentials)
26      {
27          this.user = credentials.getUsername();
28          this.credentials = credentials.getPassword();
29      }
30  
31      public void setAuthenticated(boolean b)
32      {
33          authenticated = b;
34      }
35  
36      public boolean isAuthenticated()
37      {
38          return authenticated;
39      }
40  
41      public Object getCredentials()
42      {
43          return new String(credentials);
44      }
45  
46      public Object getPrincipal()
47      {
48          return user;
49      }
50  
51      public Map getProperties()
52      {
53          return properties;
54      }
55  
56      public void setProperties(Map properties)
57      {
58          this.properties = properties;
59      }
60  
61  }