-
Notifications
You must be signed in to change notification settings - Fork 4
Form based Login
The Form based authentication is used in the Database and LDAP auth backend scenario. It involves a login page where the user enter a username and a password in order to authenticate. Hot will search for a matching user in the authentication database or in the LDAP server depending of the auth backend added to the project.
Trying to access secured static resources like htmlpages, JS scripts, css files, images,... through a web browser will redirect the user to either a login.html page located in www if it exists or to a generated login form.
If you wish to use your own login page, just create a login.html in the www folder. It must contain an HTML <form> like this one.
<form action="login" method="POST">
<h1>Soumission</h1>
<p id="login-form">
<label for="login">Login :</label>
<input type="text" name="username" id="login" value="" placeholder="Your login" autofocus>
</p>
<p id="password">
<label for="password">Password :</label>
<input type="password" name="password" id="password" value="" placeholder="Your password">
</p>
<p>
<button>Connect</button>
</p>
</form>You will notice the login value for the <form> action attribute.
The username and password will be sent to the server in order to search a matching user. The password will be automatically encoded using the BCrypt encoder if a database backend is used.
Once a matching user is found, the user can access to all secured static resources and all protected REST endpoints.