commit | author | age
|
2a4fb8
|
1 |
/* |
U |
2 |
http-realm - Authentication Extensions to jdk.httpserver |
|
3 |
Copyright (C) 2021 Ulrich Hilger |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
package de.uhilger.httpserver.auth.realm; |
|
19 |
|
|
20 |
/** |
|
21 |
* A Realm is a "database" of usernames and passwords that identify valid |
|
22 |
* users of an application (or a set of applications), plus a list of roles |
|
23 |
* associated with each valid user. |
|
24 |
* |
|
25 |
* You can think of roles as similar to groups in Unix-like operating systems, |
|
26 |
* because access to specific web application resources is granted to all |
|
27 |
* users possessing a particular role (rather than enumerating the list of |
|
28 |
* associated usernames). A particular user can have any number of roles |
|
29 |
* associated with their username. |
|
30 |
* |
|
31 |
* @author Ulrich Hilger |
|
32 |
* @version 1, 22.05.2021 |
|
33 |
*/ |
|
34 |
public interface Realm { |
|
35 |
|
|
36 |
/** |
|
37 |
* Uberpruefen, ob die Benutzerkennung und das Kennwort gueltig sind. |
|
38 |
* |
|
39 |
* @param userId der Benutzer |
|
40 |
* @param password das Kennwort des Benutzers |
|
41 |
* @return true, wenn die Angaben stimmen, false wenn nicht |
|
42 |
*/ |
|
43 |
public boolean isValid(String userId, String password); |
|
44 |
|
|
45 |
/** |
|
46 |
* Pruefen, ob ein Benutzer eine Rolle hat |
|
47 |
* |
|
48 |
* @param userId der Benutzer |
|
49 |
* @param roleId die Kennung der Rolle |
|
50 |
* @return true, wenn der Benutzer die Rolle hat, false wenn nicht |
|
51 |
*/ |
|
52 |
public boolean hasRole(String userId, String roleId); |
|
53 |
|
|
54 |
/** |
|
55 |
* Den Namen dieses Realms ermitteln |
|
56 |
* @return Name des Realms |
|
57 |
*/ |
|
58 |
public String getName(); |
|
59 |
|
|
60 |
} |