KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > authentication > AuthenticationConf


1 /*
2   Copyright (C) 2001-2002 Renaud Pawlak <renaud@aopsys.com>
3                           Laurent Martelli <laurent@aopsys.com>
4   
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU Lesser General Public License as
7   published by the Free Software Foundation; either version 2 of the
8   License, or (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   GNU Lesser General Public License for more details.
14
15   You should have received a copy of the GNU Lesser General Public License
16   along with this program; if not, write to the Free Software
17   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

18
19 package org.objectweb.jac.aspects.authentication;
20
21 import org.objectweb.jac.core.rtti.ClassItem;
22 import org.objectweb.jac.core.rtti.MethodItem;
23
24
25 /**
26  * This is the configuration interface of the authentication aspect.
27  *
28  * <p>The authentication aspect's goal is to make sure that a user
29  * attribute is defined within the context. Several authentication
30  * policies are available and defined in the controller.
31  *
32  * @see AuthenticationAC
33  * @see #setAuthenticator(ClassItem)
34  * @see #setAuthenticator(ClassItem,String[]) */

35
36 public interface AuthenticationConf {
37
38    /**
39     * This configuration method restricts a given set of methods.
40     *
41     * <p>When a method is restricted, the collaboration that contains
42     * the restricted method invocation must contain an attribute that
43     * represents the current user. If not, the authentication aspect
44     * ask the user to input its caracteristics.<p>
45     *
46     * @param classes a class expression
47     * @param objects an object expression
48     * @param methods an expression matching the methods to restrict
49     * @see #addRestrictedObjects(String)
50     * @see AuthenticationWrapper
51     */

52    
53    void addRestrictedMethods(String JavaDoc classes,
54                              String JavaDoc methods,
55                              String JavaDoc objects );
56
57    /**
58     * This configuration method sets a controller method to a set of
59     * base methods.
60     *
61     * <p>Once the user is authenticated, the controller method is
62     * called with the user and the wrappee and the wrapped method as
63     * parameters. If the controller returns true, the user is allowed
64     * to call the method, otherwise an exception is raised.</p>
65     *
66     * @param classes a class expression
67     * @param methods an expression matching the methods to restrict
68     * @param controller the controller method (a static method of the
69     * prototype <code>boolean controller(String username,Object
70     * wrappee,MethodItem method)</code>)
71     *
72     * @see #setDisplayController(MethodItem)
73     * @see org.objectweb.jac.aspects.user.UserAC#userController(String,Object,MethodItem)
74     * @see AuthenticationWrapper#dummyController(String,Object,MethodItem)
75     * @see AuthenticationWrapper
76     */

77    void setController(String JavaDoc classes, String JavaDoc methods, MethodItem controller);
78
79    /**
80     * This configuration method sets a controller on displays so that
81     * all users must authenticate themselves before accessing the
82     * application.
83     *
84     * @param controller the controller method (a static method of the
85     * prototype <code>boolean controller(String username,Object
86     * wrappee,MethodItem method)</code>)
87     *
88     * @see #setController(String,String,MethodItem)
89     * @see org.objectweb.jac.aspects.user.UserAC#userController(String,Object,MethodItem)
90     * @see AuthenticationWrapper#dummyController(String,Object,MethodItem)
91     * @see AuthenticationWrapper */

92    void setDisplayController(MethodItem controller);
93
94    /**
95     * Sets the message that is showed to the user when the access to a
96     * method is not granted by the controller (if any).
97     *
98     * @param message the message to popup
99     * @see #setController(String,String,MethodItem)
100     */

101    void setAccessDeniedMessage(String JavaDoc message);
102
103    /**
104     * Restricts some objects for authentication (all their methods).
105     *
106     * @param objects an object expression
107     * @see #addRestrictedMethods(String,String,String)
108     * @see AuthenticationWrapper */

109    
110    void addRestrictedObjects(String JavaDoc objects);
111
112    /**
113     * Restricts some objects for authentication.
114     *
115     * @param classes a class expression
116     * @param objects an object expression
117     * @see #addRestrictedMethods(String,String,String)
118     * @see AuthenticationWrapper
119     */

120    void addRestrictedObjects(String JavaDoc objects,String JavaDoc classes);
121
122    /**
123     * Sets the authenticator to use.
124     *
125     * <p>The most used authenticator is the
126     * <code>org.objectweb.jac.aspects.authentication.UserPasswordAuthenticator</code>. It
127     * opens a popup on the current display to ask the user its login
128     * and password.</p>
129     *
130     * @param authenticatorClass the authenticator's class
131     * @param parameters parameters to give to the constructor
132     * @see Authenticator
133     * @see UserPasswordAuthenticator */

134
135    void setAuthenticator(ClassItem authenticatorClass, String JavaDoc[] parameters);
136
137    /**
138     * Sets the authenticator to use when the authenticator's
139     * constructor takes no parameters.
140     *
141     * <p>The most used authenticator is the
142     * <code>org.objectweb.jac.aspects.authentication.UserPasswordAuthenticator</code>. It
143     * opens a popup on the current display to ask the user its
144     * login and password.</p>
145     *
146     * @param authenticatorClass the authenticator's class
147     * @see #setAuthenticator(ClassItem,String[])
148     * @see Authenticator
149     * @see UserPasswordAuthenticator */

150
151    void setAuthenticator(ClassItem authenticatorClass);
152
153 }
154
Popular Tags