ed6d0ba44fee70387a907e8adfae86146f017c55
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / sp / auth / ServiceProxyUser.java
1 package com.indexdata.mkjsf.pazpar2.sp.auth;\r
2 \r
3 import java.util.Arrays;\r
4 import java.util.HashMap;\r
5 import java.util.List;\r
6 import java.util.Map;\r
7 \r
8 import javax.enterprise.context.SessionScoped;\r
9 import javax.inject.Named;\r
10 \r
11 import org.apache.log4j.Logger;\r
12 \r
13 import com.indexdata.mkjsf.utils.Utils;\r
14 \r
15 @Named("user") @SessionScoped\r
16 public class ServiceProxyUser implements AuthenticationEntity {\r
17 \r
18   private static final long serialVersionUID = 2351542518778803071L;\r
19   private List<String> possibleProperties = Arrays.asList("name","password","realm");\r
20   private Map<String,String> actualProperties = new HashMap<String,String>();\r
21   private static Logger logger = Logger.getLogger(ServiceProxyUser.class);\r
22   private boolean authenticated = false;\r
23 \r
24   public ServiceProxyUser()  {\r
25     logger.debug("ServiceProxyUser instantiated: " + Utils.objectId(this));\r
26   }\r
27   \r
28   public void setAuthenticationMethod() {    \r
29   }\r
30 \r
31   public String getName() { \r
32     return actualProperties.get("name"); \r
33   }\r
34   \r
35   public void setName(String newValue) { \r
36     actualProperties.put("name", newValue); \r
37   }\r
38   \r
39   public String getPassword() { \r
40     return actualProperties.get("password"); \r
41   }\r
42   \r
43   public void setPassword(String newValue) { \r
44     actualProperties.put("password", newValue);\r
45   }\r
46   \r
47   public void setRealm(String realm) {\r
48     actualProperties.put("realm", realm);\r
49   }\r
50   \r
51   public String getRealm() {\r
52     return actualProperties.get("realm");\r
53   }\r
54    \r
55   public void isAuthenticated(boolean authenticated) {\r
56     this.authenticated = authenticated;\r
57   }\r
58   \r
59   public boolean isAuthenticated() {\r
60     return authenticated;\r
61   }\r
62   \r
63 \r
64   @Override\r
65   public String getProperty(String key) {\r
66     return actualProperties.get(key);\r
67   }\r
68 \r
69   @Override\r
70   public Map<String, String> getPropertyMap() {\r
71     return actualProperties;\r
72   }\r
73 \r
74   @Override\r
75   public List<String> getPossibleProperties() {\r
76     return possibleProperties;\r
77   } \r
78   \r
79 \r
80 }\r