/* jwtTest - JSON Web Token Testimplementierung Copyright (C) 2021 Ulrich Hilger This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package de.uhilger.httpserver.auth; import com.sun.net.httpserver.Authenticator; import com.sun.net.httpserver.HttpExchange; import java.util.logging.Logger; /** * Der ApiAuthenticator ueberlaesst dem Client die Erzeugung eines * Login-Formulars und meldet nur, dass eines noetig ist, wenn die * Superklasse JWTAuthenticator dies festgestellt und die * Methode login gerufen hat. * * Alle anderen Methoden, die zur Authenthifizierung benoetigt werden, * erbt der AppiAuthenticator vom JWTAuthenticator. * * @author Ulrich Hilger * @version 1, 30.05.2021 */ public class ApiAuthenticator extends TokenAuthenticator { /* Der Logger fuer diesen ApiAuthenticator */ private static final Logger logger = Logger.getLogger(ApiAuthenticator.class.getName()); public ApiAuthenticator() { super(); } @Override protected Result login(HttpExchange exchange) { return new Authenticator.Retry(SC_UNAUTHORIZED); } }