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; |
|
19 |
|
|
20 |
import com.sun.net.httpserver.Authenticator; |
|
21 |
import com.sun.net.httpserver.HttpExchange; |
|
22 |
import java.util.logging.Logger; |
|
23 |
|
|
24 |
/** |
|
25 |
* Der ApiAuthenticator ueberlaesst dem Client die Erzeugung eines |
|
26 |
* Login-Formulars und meldet nur, dass eines noetig ist, wenn die |
|
27 |
* Superklasse JWTAuthenticator dies festgestellt und die |
|
28 |
* Methode <code>login</code> gerufen hat. |
|
29 |
* |
|
30 |
* Alle anderen Methoden, die zur Authenthifizierung benoetigt werden, |
|
31 |
* erbt der AppiAuthenticator vom JWTAuthenticator. |
|
32 |
* |
|
33 |
* @author Ulrich Hilger |
|
34 |
* @version 1, 30.05.2021 |
|
35 |
*/ |
|
36 |
public class ApiAuthenticator extends TokenAuthenticator { |
|
37 |
|
|
38 |
/* Der Logger fuer diesen ApiAuthenticator */ |
|
39 |
private static final Logger logger = Logger.getLogger(ApiAuthenticator.class.getName()); |
|
40 |
|
|
41 |
public ApiAuthenticator() { |
|
42 |
super(); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected Result login(HttpExchange exchange) { |
|
47 |
return new Authenticator.Retry(SC_UNAUTHORIZED); |
|
48 |
} |
|
49 |
|
|
50 |
} |