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