commit | author | age
|
9ee357
|
1 |
/* |
c7d492
|
2 |
http-auth - Authentication Extensions to jdk.httpserver |
9ee357
|
3 |
Copyright (C) 2021 Ulrich Hilger |
U |
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 |
c7d492
|
22 |
* users of an application (or a set of applications), plus a list of roles |
U |
23 |
* associated with each valid user. |
9ee357
|
24 |
* |
U |
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 |
* |
c7d492
|
39 |
* @param userId der Benutzer |
U |
40 |
* @param password das Kennwort des Benutzers |
9ee357
|
41 |
* @return true, wenn die Angaben stimmen, false wenn nicht |
U |
42 |
*/ |
c7d492
|
43 |
public boolean isValid(String userId, String password); |
9ee357
|
44 |
|
U |
45 |
/** |
|
46 |
* Pruefen, ob ein Benutzer eine Rolle hat |
|
47 |
* |
c7d492
|
48 |
* @param userId der Benutzer |
696a4b
|
49 |
* @param roleId die Kennung der Rolle |
9ee357
|
50 |
* @return true, wenn der Benutzer die Rolle hat, false wenn nicht |
U |
51 |
*/ |
696a4b
|
52 |
public boolean hasRole(String userId, String roleId); |
9ee357
|
53 |
|
U |
54 |
/** |
|
55 |
* Den Namen dieses Realms ermitteln |
|
56 |
* @return Name des Realms |
|
57 |
*/ |
|
58 |
public String getName(); |
|
59 |
|
|
60 |
} |