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