@Test public void testLoginChangeFormLoginHandlerParams() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam); testLogin(); }
/** * Set the name of the form param used to submit the username * @param usernameParam the name of the param * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setUsernameParam(String usernameParam) { delegate.setUsernameParam(usernameParam); return this; }
/** * Set the name of the form param used to submit the username * @param usernameParam the name of the param * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setUsernameParam(String usernameParam) { delegate.setUsernameParam(usernameParam); return this; }
@Test public void testFormLoginHandlerDirectDefaultResponse() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam); router.route().handler(LoggerHandler.create()); router.route().handler(BodyHandler.create()); router.route().handler(CookieHandler.create()); router.route("/login").handler(formLoginHandler); testRequest(HttpMethod.POST, "/login", sendLoginRequestConsumer(), resp -> { }, 200, "OK", "<html><body><h1>Login successful</h1></body></html>"); }
@Test public void testFormLoginHandlerDirectSpecifyLoggedInURL() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; String loggedInDirectOKPage = "/youloggedinokpage.html"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam).setDirectLoggedInOKURL(loggedInDirectOKPage); router.route().handler(LoggerHandler.create()); router.route().handler(BodyHandler.create()); router.route().handler(CookieHandler.create()); router.route("/login").handler(formLoginHandler); testRequest(HttpMethod.POST, "/login", sendLoginRequestConsumer(), resp -> { String location = resp.headers().get("location"); assertNotNull(location); assertEquals(loggedInDirectOKPage, location); }, 302, "Found", null); }
@Test public void testLoginChangeFormLoginHandlerParams() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam); testLogin(); }
@Test public void testFormLoginHandlerDirectDefaultResponse() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam); router.route().handler(LoggerHandler.create()); router.route().handler(BodyHandler.create()); router.route().handler(CookieHandler.create()); router.route("/login").handler(formLoginHandler); testRequest(HttpMethod.POST, "/login", sendLoginRequestConsumer(), resp -> { }, 200, "OK", "<html><body><h1>Login successful</h1></body></html>"); }
@Test public void testFormLoginHandlerDirectSpecifyLoggedInURL() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; String loggedInDirectOKPage = "/youloggedinokpage.html"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam).setDirectLoggedInOKURL(loggedInDirectOKPage); router.route().handler(LoggerHandler.create()); router.route().handler(BodyHandler.create()); router.route().handler(CookieHandler.create()); router.route("/login").handler(formLoginHandler); testRequest(HttpMethod.POST, "/login", sendLoginRequestConsumer(), resp -> { String location = resp.headers().get("location"); assertNotNull(location); assertEquals(loggedInDirectOKPage, location); }, 302, "Found", null); }