{% extends "../demos.html" %} {% block subSectionClasses %}demo_form_auth{% endblock %} {% block meta_title %}Demo - Form Authentication{% endblock %} {% block meta_description %}Form Authentication demo using Spincast{% endblock %} {% block subBody %}
You can register using a temporary account usin a "[anything]@example.com" email. This will create an account which will be valid for 24 hours.
Once the account is created, you will be able to login, logout, use the
"remember me" feature
and save some preferences to test the session feature.
Enter username and password to log on:
Fill in the form below to get instant access:
Protecting a resource or a set of resources with HTTP authentication
is very easy. You simply use the httpAuth(...) method
of the router. You specify the route to protect and a name to identify that "realm"
(the protected section).
router.httpAuth("/route/to/protect", "protected example");
The resource is then protected!
But how do you specify which username/password combinations
are allowed to access that realm? You use the addHttpAuthentication(...) method
of the server instance. You specify the name of the realm and a username/password
allowed to access it. Of course, you can add more that one credential for the same realm!
server.addHttpAuthentication("protected example", "Stromgol", "Laroche")
Learn more about HTTP Authentication in the documentation.