commit | author | age
|
db4f6b
|
1 |
/* |
JM |
2 |
* Copyright 2013 gitblit.com. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
16 |
package com.gitblit.manager; |
|
17 |
|
|
18 |
import javax.servlet.http.HttpServletRequest; |
|
19 |
import javax.servlet.http.HttpServletResponse; |
|
20 |
|
04a985
|
21 |
import com.gitblit.models.TeamModel; |
db4f6b
|
22 |
import com.gitblit.models.UserModel; |
bcc8a0
|
23 |
import com.gitblit.transport.ssh.SshKey; |
db4f6b
|
24 |
|
04a985
|
25 |
public interface IAuthenticationManager extends IManager { |
db4f6b
|
26 |
|
JM |
27 |
/** |
|
28 |
* Authenticate a user based on HTTP request parameters. |
|
29 |
* |
|
30 |
* Authentication by X509Certificate is tried first and then by cookie. |
|
31 |
* |
|
32 |
* @param httpRequest |
|
33 |
* @return a user object or null |
3a6499
|
34 |
* @since 1.4.0 |
db4f6b
|
35 |
*/ |
JM |
36 |
UserModel authenticate(HttpServletRequest httpRequest); |
|
37 |
|
44e2ee
|
38 |
/** |
bcc8a0
|
39 |
* Authenticate a user based on a ssh public key. |
44e2ee
|
40 |
* |
JM |
41 |
* @param username |
|
42 |
* @param key |
|
43 |
* @return a user object or null |
3a6499
|
44 |
* * @since 1.5.0 |
44e2ee
|
45 |
*/ |
bcc8a0
|
46 |
UserModel authenticate(String username, SshKey key); |
e3b636
|
47 |
|
db4f6b
|
48 |
/** |
JM |
49 |
* Authenticate a user based on HTTP request parameters. |
|
50 |
* |
|
51 |
* Authentication by X509Certificate, servlet container principal, cookie, |
|
52 |
* and BASIC header. |
|
53 |
* |
|
54 |
* @param httpRequest |
|
55 |
* @param requiresCertificate |
|
56 |
* @return a user object or null |
3a6499
|
57 |
* @since 1.4.0 |
db4f6b
|
58 |
*/ |
JM |
59 |
UserModel authenticate(HttpServletRequest httpRequest, boolean requiresCertificate); |
|
60 |
|
aa6d43
|
61 |
/** |
JM |
62 |
* Authenticate a user based on a username and password. |
|
63 |
* |
|
64 |
* @see IUserService.authenticate(String, char[]) |
|
65 |
* @param username |
|
66 |
* @param password |
|
67 |
* @return a user object or null |
3a6499
|
68 |
* @since 1.4.0 |
aa6d43
|
69 |
*/ |
db4f6b
|
70 |
UserModel authenticate(String username, char[] password); |
JM |
71 |
|
|
72 |
/** |
7ab32b
|
73 |
* Returns the Gitlbit cookie in the request. |
JM |
74 |
* |
|
75 |
* @param request |
|
76 |
* @return the Gitblit cookie for the request or null if not found |
3a6499
|
77 |
* @since 1.4.0 |
7ab32b
|
78 |
*/ |
JM |
79 |
String getCookie(HttpServletRequest request); |
|
80 |
|
|
81 |
/** |
db4f6b
|
82 |
* Sets a cookie for the specified user. |
JM |
83 |
* |
|
84 |
* @param response |
|
85 |
* @param user |
3a6499
|
86 |
* @since 1.4.0 |
db4f6b
|
87 |
*/ |
ec7ed8
|
88 |
@Deprecated |
db4f6b
|
89 |
void setCookie(HttpServletResponse response, UserModel user); |
ec7ed8
|
90 |
|
JM |
91 |
/** |
|
92 |
* Sets a cookie for the specified user. |
|
93 |
* |
|
94 |
* @param request |
|
95 |
* @param response |
|
96 |
* @param user |
|
97 |
* @since 1.6.1 |
|
98 |
*/ |
|
99 |
void setCookie(HttpServletRequest request, HttpServletResponse response, UserModel user); |
db4f6b
|
100 |
|
JM |
101 |
/** |
|
102 |
* Logout a user. |
|
103 |
* |
|
104 |
* @param user |
3a6499
|
105 |
* @since 1.4.0 |
db4f6b
|
106 |
*/ |
ec7ed8
|
107 |
@Deprecated |
db4f6b
|
108 |
void logout(HttpServletResponse response, UserModel user); |
JM |
109 |
|
04a985
|
110 |
/** |
ec7ed8
|
111 |
* Logout a user. |
JM |
112 |
* |
|
113 |
* @param request |
|
114 |
* @param response |
|
115 |
* @param user |
|
116 |
* @since 1.6.1 |
|
117 |
*/ |
|
118 |
void logout(HttpServletRequest request, HttpServletResponse response, UserModel user); |
|
119 |
|
|
120 |
/** |
04a985
|
121 |
* Does the user service support changes to credentials? |
JM |
122 |
* |
|
123 |
* @return true or false |
3a6499
|
124 |
* @since 1.4.0 |
04a985
|
125 |
*/ |
JM |
126 |
boolean supportsCredentialChanges(UserModel user); |
|
127 |
|
|
128 |
/** |
|
129 |
* Returns true if the user's display name can be changed. |
|
130 |
* |
|
131 |
* @param user |
|
132 |
* @return true if the user service supports display name changes |
3a6499
|
133 |
* @since 1.4.0 |
04a985
|
134 |
*/ |
JM |
135 |
boolean supportsDisplayNameChanges(UserModel user); |
|
136 |
|
|
137 |
/** |
|
138 |
* Returns true if the user's email address can be changed. |
|
139 |
* |
|
140 |
* @param user |
|
141 |
* @return true if the user service supports email address changes |
3a6499
|
142 |
* @since 1.4.0 |
04a985
|
143 |
*/ |
JM |
144 |
boolean supportsEmailAddressChanges(UserModel user); |
|
145 |
|
|
146 |
/** |
|
147 |
* Returns true if the user's team memberships can be changed. |
|
148 |
* |
|
149 |
* @param user |
|
150 |
* @return true if the user service supports team membership changes |
3a6499
|
151 |
* @since 1.4.0 |
04a985
|
152 |
*/ |
JM |
153 |
boolean supportsTeamMembershipChanges(UserModel user); |
|
154 |
|
|
155 |
/** |
|
156 |
* Returns true if the team memberships can be changed. |
|
157 |
* |
|
158 |
* @param user |
|
159 |
* @return true if the team memberships can be changed |
3a6499
|
160 |
* @since 1.4.0 |
04a985
|
161 |
*/ |
JM |
162 |
boolean supportsTeamMembershipChanges(TeamModel team); |
|
163 |
|
db4f6b
|
164 |
} |