1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.module.jaas; |
8 | |
|
9 | |
import org.mule.api.security.Authentication; |
10 | |
import org.mule.api.security.Credentials; |
11 | |
|
12 | |
import java.util.Map; |
13 | |
|
14 | |
import javax.security.auth.Subject; |
15 | |
|
16 | |
public class JaasAuthentication implements Authentication |
17 | |
{ |
18 | |
private boolean authenticated; |
19 | |
private char[] credentials; |
20 | |
private String user; |
21 | |
private Map properties; |
22 | |
private Subject subject; |
23 | |
|
24 | |
public JaasAuthentication(Credentials credentials) |
25 | 0 | { |
26 | 0 | this.user = credentials.getUsername(); |
27 | 0 | this.credentials = credentials.getPassword(); |
28 | 0 | } |
29 | |
|
30 | |
public JaasAuthentication(Object user, Object credentials, Subject subject) |
31 | 0 | { |
32 | 0 | this.user = (String) user; |
33 | 0 | this.credentials = ((String) credentials).toCharArray(); |
34 | 0 | this.subject = subject; |
35 | 0 | } |
36 | |
|
37 | |
public void setAuthenticated(boolean b) |
38 | |
{ |
39 | 0 | authenticated = b; |
40 | 0 | } |
41 | |
|
42 | |
public boolean isAuthenticated() |
43 | |
{ |
44 | 0 | return authenticated; |
45 | |
} |
46 | |
|
47 | |
public Object getCredentials() |
48 | |
{ |
49 | 0 | return new String(credentials); |
50 | |
} |
51 | |
|
52 | |
public Object getPrincipal() |
53 | |
{ |
54 | 0 | return user; |
55 | |
} |
56 | |
|
57 | |
public Map getProperties() |
58 | |
{ |
59 | 0 | return properties; |
60 | |
} |
61 | |
|
62 | |
public void setProperties(Map properties) |
63 | |
{ |
64 | 0 | this.properties = properties; |
65 | 0 | } |
66 | |
|
67 | |
public Subject getSubject() |
68 | |
{ |
69 | 0 | return subject; |
70 | |
} |
71 | |
} |