]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms/src/org/argeo/cms/CmsUserManager.java
[maven-release-plugin] prepare release argeo-commons-2.3.5
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / CmsUserManager.java
1 package org.argeo.cms;
2
3 import java.time.ZonedDateTime;
4 import java.util.List;
5 import java.util.Set;
6
7 import javax.security.auth.Subject;
8
9 import org.osgi.framework.InvalidSyntaxException;
10 import org.osgi.service.useradmin.Role;
11 import org.osgi.service.useradmin.User;
12
13 /**
14 * Provide method interfaces to manage user concepts without accessing directly
15 * the userAdmin.
16 */
17 public interface CmsUserManager {
18
19 // CurrentUser
20 /** Returns the e-mail of the current logged in user */
21 public String getMyMail();
22
23 // Other users
24 /** Returns a {@link User} given a username */
25 public User getUser(String username);
26
27 /** Can be a group or a user */
28 public String getUserDisplayName(String dn);
29
30 /** Can be a group or a user */
31 public String getUserMail(String dn);
32
33 /** Lists all roles of the given user */
34 public String[] getUserRoles(String dn);
35
36 /** Checks if the passed user belongs to the passed role */
37 public boolean isUserInRole(String userDn, String roleDn);
38
39 // Search
40 /** Returns a filtered list of roles */
41 public Role[] getRoles(String filter) throws InvalidSyntaxException;
42
43 /** Recursively lists users in a given group. */
44 public Set<User> listUsersInGroup(String groupDn, String filter);
45
46 /** Search among groups including system roles and users if needed */
47 public List<User> listGroups(String filter, boolean includeUsers, boolean includeSystemRoles);
48
49 /* MISCELLANEOUS */
50 /** Returns the dn of a role given its local ID */
51 public String buildDefaultDN(String localId, int type);
52
53 /** Exposes the main default domain name for this instance */
54 public String getDefaultDomainName();
55
56 /**
57 * Search for a {@link User} (might also be a group) whose uid or cn is equals
58 * to localId within the various user repositories defined in the current
59 * context.
60 */
61 public User getUserFromLocalId(String localId);
62
63 void changeOwnPassword(char[] oldPassword, char[] newPassword);
64
65 void resetPassword(String username, char[] newPassword);
66
67 @Deprecated
68 String addSharedSecret(String username, int hours);
69
70 // String addSharedSecret(String username, String authInfo, String authToken);
71
72 void addAuthToken(String userDn, String token, Integer hours, String... roles);
73
74 void addAuthToken(String userDn, String token, ZonedDateTime expiryDate, String... roles);
75
76 void expireAuthToken(String token);
77
78 void expireAuthTokens(Subject subject);
79
80 // User createUserFromPerson(Node person);
81
82 // @Deprecated
83 // public UserAdmin getUserAdmin();
84 //
85 // @Deprecated
86 // public UserTransaction getUserTransaction();
87 }