diff --git a/src/main/java/de/gnmyt/autoresponder/SimpleAutoResponder.java b/src/main/java/de/gnmyt/autoresponder/SimpleAutoResponder.java index 87064ea..93fd533 100644 --- a/src/main/java/de/gnmyt/autoresponder/SimpleAutoResponder.java +++ b/src/main/java/de/gnmyt/autoresponder/SimpleAutoResponder.java @@ -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. + *
+ * 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 *