]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - JcrArgeoUser.java
131d6ea5ebcdc5570a9094b560d8d21828dfd420
1 package org
.argeo
.security
.jcr
;
3 import java
.util
.ArrayList
;
4 import java
.util
.Collections
;
9 import javax
.jcr
.RepositoryException
;
11 import org
.argeo
.ArgeoException
;
12 import org
.argeo
.security
.ArgeoUser
;
13 import org
.argeo
.security
.UserNature
;
15 public class JcrArgeoUser
implements ArgeoUser
{
16 /** Cached for performance reasons. */
17 private final String username
;
18 private final Node home
;
19 private final List
<String
> roles
;
20 private final Boolean enabled
;
21 private final String password
;
23 public JcrArgeoUser(Node home
, String password
, List
<String
> roles
,
26 this.password
= password
;
27 this.roles
= Collections
.unmodifiableList(new ArrayList
<String
>(roles
));
28 this.enabled
= enabled
;
30 username
= home
.getSession().getUserID();
31 } catch (RepositoryException e
) {
32 throw new ArgeoException("Cannot find JCR user id", e
);
37 public String
getUsername() {
41 public Map
<String
, UserNature
> getUserNatures() {
42 throw new UnsupportedOperationException("deprecated");
45 public void updateUserNatures(Map
<String
, UserNature
> userNatures
) {
46 throw new UnsupportedOperationException("deprecated");
49 public List
<String
> getRoles() {
53 public String
getPassword() {
57 public Node
getHome() {
61 public Boolean
getEnabled() {
65 public boolean equals(Object obj
) {
66 if (!(obj
instanceof ArgeoUser
))
68 return ((ArgeoUser
) obj
).getUsername().equals(username
);
72 public int hashCode() {
73 return username
.hashCode();
76 public String
toString() {
77 return getUsername() + "@" + getHome();