View Javadoc

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