Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / identitymanagement / SimpleIdentityManager.java @ 2590

History | View | Annotate | Download (1.97 KB)

1
package org.gvsig.tools.identitymanagement;
2

    
3
import java.util.Collection;
4
import java.util.List;
5

    
6

    
7
public interface SimpleIdentityManager {
8
    //
9
    // http://en.wikipedia.org/wiki/Identity_management
10
    //
11
    
12
    public static final String GUEST_IDENTITY_ID = "guest";
13
    
14
    /**
15
     * Authenticate the identity in the system and stablish a session with this
16
     * identity.
17
     * If the identityid don't exists or the password specified is incorrect, throw
18
     * a exception.
19
     *
20
     * If the domain is not required it can not be null.
21
     *
22
     * @param domain, the domain used to authenticate the user
23
     * @param identityid, identity id to login in the system
24
     * @param password
25
     */
26
    public void login(String domain, String identityid, String password) throws UnauthorizedException;
27

    
28
    /**
29
     * Closes the session stablised with the current identity.
30
     */
31
    public void logout();
32

    
33
    /**
34
     * Return the identity of the current session in the system.
35
     * Can't be null.
36
     *
37
     * @return the current identity
38
     */
39
    public SimpleIdentity getCurrentIdentity();
40

    
41
    public SimpleIdentity getAdministrator();
42
    
43
    /**
44
     * Inform if the login process require a domain name.
45
     *
46
     * @return true if a domain name is required.
47
     */
48
    public boolean needDomain();
49
    
50
    /**
51
     * Run the specified action as the specified identity.
52
     * 
53
     * @param domain
54
     * @param identityid
55
     * @param acction 
56
     */
57
    public void sudo(String domain, String identityid, Runnable acction);
58
 
59
    /**
60
     * Register the actionName as an action that require authorization.
61
     * 
62
     * @param actionName 
63
     */
64
    public void registerAction(String actionName);
65
    
66
    /**
67
     * Return a list of the actions that are registered.
68
     * 
69
     * @return list of action names that requiere authorization.
70
     */
71
    public Collection getActions();
72
    
73
    public void addRule(Rule rule);
74
    
75
    public Collection<Rule> getRules();
76
}