@Test public void testLoginChangeFormLoginHandlerParams() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam); testLogin(); }
@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); }
router.route("/loginhandler").handler(FormLoginHandler.create(authProvider));
/** * Set the name of the form param used to submit the password * @param passwordParam the name of the param * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setPasswordParam(String passwordParam) { delegate.setPasswordParam(passwordParam); return this; }
/** * Set the url to redirect to if the user logs in directly at the url of the form login handler * without being redirected here first * @param directLoggedInOKURL the URL to redirect to * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setDirectLoggedInOKURL(String directLoggedInOKURL) { delegate.setDirectLoggedInOKURL(directLoggedInOKURL); 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; }
/** * Set the name of the session attrioute used to specify the return url * @param returnURLParam the name of the param * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setReturnURLParam(String returnURLParam) { delegate.setReturnURLParam(returnURLParam); return this; }
/** * Something has happened, so handle it. * @param event the event to handle */ public void handle(io.vertx.rxjava.ext.web.RoutingContext event) { delegate.handle(event.getDelegate()); }
@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); }
router.route("/loginhandler").handler(FormLoginHandler.create(authProvider));
/** * Set the name of the form param used to submit the password * @param passwordParam the name of the param * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setPasswordParam(String passwordParam) { delegate.setPasswordParam(passwordParam); return this; }
/** * Set the url to redirect to if the user logs in directly at the url of the form login handler * without being redirected here first * @param directLoggedInOKURL the URL to redirect to * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setDirectLoggedInOKURL(String directLoggedInOKURL) { delegate.setDirectLoggedInOKURL(directLoggedInOKURL); 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; }
/** * Set the name of the session attrioute used to specify the return url * @param returnURLParam the name of the param * @return a reference to this for a fluent API */ public io.vertx.rxjava.ext.web.handler.FormLoginHandler setReturnURLParam(String returnURLParam) { delegate.setReturnURLParam(returnURLParam); return this; }
/** * Something has happened, so handle it. * @param event the event to handle */ public void handle(io.vertx.rxjava.ext.web.RoutingContext event) { delegate.handle(event.getDelegate()); }
@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>"); }
/** * Create a handler * @param authProvider the auth service to use * @return the handler */ public static io.vertx.rxjava.ext.web.handler.FormLoginHandler create(io.vertx.rxjava.ext.auth.AuthProvider authProvider) { io.vertx.rxjava.ext.web.handler.FormLoginHandler ret = io.vertx.rxjava.ext.web.handler.FormLoginHandler.newInstance(io.vertx.ext.web.handler.FormLoginHandler.create(authProvider.getDelegate())); return ret; }
@Test public void testLoginChangeFormLoginHandlerParams() throws Exception { formLoginHandler = FormLoginHandler.create(authProvider); usernameParam = "username2"; passwordParam ="password2"; formLoginHandler.setUsernameParam(usernameParam).setPasswordParam(passwordParam); testLogin(); }
/** * Create a handler * @param authProvider the auth service to use * @return the handler */ public static io.vertx.rxjava.ext.web.handler.FormLoginHandler create(io.vertx.rxjava.ext.auth.AuthProvider authProvider) { io.vertx.rxjava.ext.web.handler.FormLoginHandler ret = io.vertx.rxjava.ext.web.handler.FormLoginHandler.newInstance(io.vertx.ext.web.handler.FormLoginHandler.create(authProvider.getDelegate())); return ret; }
@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>"); }