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.module.spring.security;
8   
9   import org.mule.api.security.Authentication;
10  
11  import java.util.Map;
12  
13  import org.springframework.security.core.GrantedAuthority;
14  
15  /**
16   * 
17   */
18  public class SpringAuthenticationAdapter implements Authentication
19  {
20      private static final long serialVersionUID = -5906282218126929871L;
21  
22      private org.springframework.security.core.Authentication delegate;    
23      private Map properties;
24  
25      public SpringAuthenticationAdapter(org.springframework.security.core.Authentication authentication)    
26      {
27          this.delegate = authentication;
28      }
29  
30      public SpringAuthenticationAdapter(org.springframework.security.core.Authentication authentication, Map properties)    
31      {
32          this.delegate = authentication;
33          this.properties = properties;
34      }
35  
36      public void setAuthenticated(boolean b)
37      {
38          delegate.setAuthenticated(b);
39      }
40  
41      public boolean isAuthenticated()
42      {
43          return delegate.isAuthenticated();
44      }
45  
46      public org.springframework.security.core.GrantedAuthority[] getAuthorities()    
47      {
48          return (GrantedAuthority[]) delegate.getAuthorities().toArray(new GrantedAuthority[delegate.getAuthorities().size()]);        
49      }
50  
51      public Object getCredentials()
52      {
53          return delegate.getCredentials();
54      }
55  
56      public Object getDetails()
57      {
58          return delegate.getDetails();
59      }
60  
61      public Object getPrincipal()
62      {
63          return delegate.getPrincipal();
64      }
65  
66      public int hashCode()
67      {
68          return delegate.hashCode();
69      }
70  
71      public boolean equals(Object another)
72      {
73          return delegate.equals(another);
74      }
75  
76      public String getName()
77      {
78          return delegate.getName();
79      }
80  
81      public org.springframework.security.core.Authentication getDelegate()    
82      {
83          return delegate;
84      }
85  
86      public Map getProperties()
87      {
88          return properties;
89      }
90  
91      public void setProperties(Map properties)
92      {
93          this.properties = properties;
94      }
95  }