Integrated an authentication method into the SimpleAutoResponder
This commit is contained in:
parent
66825c9a0e
commit
5e9caa7daf
@ -1,6 +1,7 @@
|
|||||||
package de.gnmyt.autoresponder;
|
package de.gnmyt.autoresponder;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpServer;
|
import com.sun.net.httpserver.HttpServer;
|
||||||
|
import de.gnmyt.autoresponder.authentication.AuthenticationDetails;
|
||||||
import de.gnmyt.autoresponder.exceptions.ResponderException;
|
import de.gnmyt.autoresponder.exceptions.ResponderException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -9,6 +10,7 @@ import java.net.InetSocketAddress;
|
|||||||
public class SimpleAutoResponder {
|
public class SimpleAutoResponder {
|
||||||
|
|
||||||
private HttpServer httpServer;
|
private HttpServer httpServer;
|
||||||
|
private AuthenticationDetails authenticationDetails;
|
||||||
|
|
||||||
private int port = 8025;
|
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
|
* Gets the port of the webserver
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user