View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.security;
8   
9   import org.mule.api.security.Authentication;
10  import org.mule.api.security.Credentials;
11  
12  import java.util.Map;
13  
14  public class DefaultMuleAuthentication implements Authentication
15  {
16      private boolean authenticated;
17      private char[] credentials;
18      private String user;
19      private Map properties;
20  
21      public DefaultMuleAuthentication(Credentials credentials)
22      {
23          this.user = credentials.getUsername();
24          this.credentials = credentials.getPassword();
25      }
26  
27      public void setAuthenticated(boolean b)
28      {
29          authenticated = b;
30      }
31  
32      public boolean isAuthenticated()
33      {
34          return authenticated;
35      }
36  
37      public Object getCredentials()
38      {
39          return new String(credentials);
40      }
41  
42      public Object getPrincipal()
43      {
44          return user;
45      }
46  
47      public Map getProperties()
48      {
49          return properties;
50      }
51  
52      public void setProperties(Map properties)
53      {
54          this.properties = properties;
55      }
56  
57  }