KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > security > AuthenticationService


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.service.cmr.security;
18
19 import org.alfresco.repo.security.authentication.AuthenticationException;
20
21 /**
22  * The authentication service defines the API for managing authentication information
23  * against a user id.
24  *
25  * @author Andy Hind
26  *
27  */

28 public interface AuthenticationService
29 {
30     /**
31      * Create an authentication for the given user.
32      *
33      * @param userName
34      * @param password
35      * @throws AuthenticationException
36      */

37     public void createAuthentication(String JavaDoc userName, char[] password) throws AuthenticationException;
38     
39     /**
40      * Update the login information for the user (typically called by the user)
41      *
42      * @param userName
43      * @param oldPassword
44      * @param newPassword
45      * @throws AuthenticationException
46      */

47     public void updateAuthentication(String JavaDoc userName, char[] oldPassword, char[] newPassword) throws AuthenticationException;
48     
49     /**
50      * Set the login information for a user (typically called by an admin user)
51      *
52      * @param userName
53      * @param newPassword
54      * @throws AuthenticationException
55      */

56     public void setAuthentication(String JavaDoc userName, char[] newPassword) throws AuthenticationException;
57     
58
59     /**
60      * Delete an authentication entry
61      *
62      * @param userName
63      * @throws AuthenticationException
64      */

65     public void deleteAuthentication(String JavaDoc userName) throws AuthenticationException;
66     
67     /**
68      * Enable or disable an authentication entry
69      *
70      * @param userName
71      * @param enabled
72      */

73     public void setAuthenticationEnabled(String JavaDoc userName, boolean enabled) throws AuthenticationException;
74     
75     /**
76      * Is an authentication enabled or disabled?
77      *
78      * @param userName
79      * @return
80      */

81     public boolean getAuthenticationEnabled(String JavaDoc userName) throws AuthenticationException;
82     
83     /**
84      * Carry out an authentication attempt. If successful the user is set to the current user.
85      * The current user is a part of the thread context.
86      *
87      * @param userName
88      * @param password
89      * @throws AuthenticationException
90      */

91     public void authenticate(String JavaDoc userName, char[] password) throws AuthenticationException;
92     
93     /**
94      * Authenticate as the guest user. This may not be allowed and throw an exception.
95      *
96      * @throws AuthenticationException
97      */

98     public void authenticateAsGuest() throws AuthenticationException;
99     
100     /**
101      * Get the name of the currently authenticated user.
102      *
103      * @return
104      * @throws AuthenticationException
105      */

106     public String JavaDoc getCurrentUserName() throws AuthenticationException;
107     
108     /**
109      * Invalidate any tickets held by the user.
110      *
111      * @param userName
112      * @throws AuthenticationException
113      */

114     public void invalidateUserSession(String JavaDoc userName) throws AuthenticationException;
115     
116    /**
117     * Invalidate a single ticket by ID
118     *
119     * @param ticket
120     * @throws AuthenticationException
121     */

122     public void invalidateTicket(String JavaDoc ticket) throws AuthenticationException;
123     
124    /**
125     * Validate a ticket. Set the current user name accordingly.
126     *
127     * @param ticket
128     * @throws AuthenticationException
129     */

130     public void validate(String JavaDoc ticket) throws AuthenticationException;
131     
132     /**
133      * Get the current ticket as a string
134      * @return
135      */

136     public String JavaDoc getCurrentTicket();
137     
138     /**
139      * Remove the current security information
140      *
141      */

142     public void clearCurrentSecurityContext();
143     
144     /**
145      * Is the current user the system user?
146      *
147      * @return
148      */

149     
150     public boolean isCurrentUserTheSystemUser();
151     
152 }
153
154
Popular Tags