Integrated an authentication method into the SimpleAutoResponder

This commit is contained in:
mathias 2021-10-01 18:56:19 +02:00
parent 66825c9a0e
commit 5e9caa7daf
No known key found for this signature in database
GPG Key ID: 8950DF62139C852A

View File

@ -1,6 +1,7 @@
package de.gnmyt.autoresponder;
import com.sun.net.httpserver.HttpServer;
import de.gnmyt.autoresponder.authentication.AuthenticationDetails;
import de.gnmyt.autoresponder.exceptions.ResponderException;
import java.io.IOException;
@ -9,6 +10,7 @@ import java.net.InetSocketAddress;
public class SimpleAutoResponder {
private HttpServer httpServer;
private AuthenticationDetails authenticationDetails;
private int port = 8025;
@ -25,6 +27,20 @@ public class SimpleAutoResponder {
}
}
/**
* Tells the responder to use an authentication.
* <p>
* If you set this you should also set the authentication parameters in the AutoResponder app
*
* @param username The name of the user you want to use for the authentication
* @param password The password of the user you want to use for the authentication
* @return the current {@link SimpleAutoResponder} instance
*/
public SimpleAutoResponder useAuthentication(String username, String password) {
authenticationDetails = new AuthenticationDetails(username, password);
return this;
}
/**
* Gets the port of the webserver
*