KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > security > AuthorizationRealm


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.core.security;
10
11 import java.util.Set JavaDoc;
12 import java.util.Collections JavaDoc;
13
14 /**
15  * The interface a component deals with.
16  * It allows a component to perform authorization queries on it.
17  *
18  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
19  * @version $Revision: 1.8 $
20  */

21 public interface AuthorizationRealm
22 {
23    /** Anonymous ( "" ) role value. */
24    String JavaDoc ANONYMOUS_ROLE = "".intern();
25
26    /** Anonymous role. */
27    Set JavaDoc ANONYMOUS_ROLE_SET = Collections.singleton(ANONYMOUS_ROLE);
28
29    /**
30     * Return true if the given role has the global permission.
31     */

32    boolean hasPermission(String JavaDoc domain, String JavaDoc role, String JavaDoc permission);
33    
34    /**
35     * Return true if one of the given roles has the global permission.
36     */

37    boolean hasPermission(String JavaDoc domain, Set JavaDoc roles, String JavaDoc permission);
38    
39    /**
40     * Return true if the given role has the local permission.
41     */

42    boolean hasPermission(String JavaDoc domain, String JavaDoc role, String JavaDoc[] path, String JavaDoc permission);
43
44    /**
45     * Return true if one of the given roles has the local permission.
46     */

47    boolean hasPermission(String JavaDoc domain, Set JavaDoc roles, String JavaDoc[] path, String JavaDoc permission);
48
49    /**
50     * Return true if the given role has the global permission.
51     */

52    boolean hasPermission(String JavaDoc role, String JavaDoc permission);
53
54    /**
55     * Return true if one of the given roles has the global permission.
56     */

57    boolean hasPermission(Set JavaDoc roles, String JavaDoc permission);
58
59    /**
60     * Return true if the given role has the local permission.
61     */

62    boolean hasPermission(String JavaDoc role, String JavaDoc[] path, String JavaDoc permission);
63
64    /**
65     * Return true if one of the given roles has the local permission.
66     */

67    boolean hasPermission(Set JavaDoc roles, String JavaDoc[] path, String JavaDoc permission);
68 }
69
Popular Tags