01: /*
02: * JFox - The most lightweight Java EE Application Server!
03: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
04: *
05: * JFox is licenced and re-distributable under GNU LGPL.
06: */
07: package org.jfox.ejb3.security;
08:
09: import java.util.List;
10: import java.util.ArrayList;
11: import javax.security.auth.callback.Callback;
12:
13: /**
14: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
15: */
16: public class JAASLoginResponseCallback implements Callback {
17:
18: private Object callbackObject;
19:
20: // 一般ç‰äºŽç”¨æˆ·å??或者 id
21: private String principalName;
22:
23: private List<String> roles = new ArrayList<String>();
24:
25: public String getPrincipalName() {
26: return principalName;
27: }
28:
29: public void setPrincipalName(String principalName) {
30: this .principalName = principalName;
31: }
32:
33: public Object getCallbackObject() {
34: return callbackObject;
35: }
36:
37: public void setCallbackObject(Object callbackObject) {
38: this .callbackObject = callbackObject;
39: }
40:
41: public List<String> getRoles() {
42: return roles;
43: }
44:
45: public void setRole(String... roles) {
46: this .roles.clear();
47: for (String roleName : roles) {
48: addRole(roleName);
49: }
50: }
51:
52: public void addRole(String role) {
53: roles.add(role);
54: }
55:
56: public void removeRole(String role) {
57: roles.remove(role);
58: }
59:
60: public static void main(String[] args) {
61:
62: }
63: }
|