templates.demos.httpAuth.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
{% extends "../demos.html" %}
{% block subSectionClasses %}demo_http_auth{% endblock %}
{% block meta_title %}Demo - HTTP Authentication{% endblock %}
{% block meta_description %}HTTP Authentication protection demo using Spincast{% endblock %}
{% block subBody %}
HTTP Authentication demo
Demo
The following page is protected using HTTP authentication:
protected page
To access it, use the following credentials:
-
Username: Stromgol
-
Password: Laroche
How to
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")
More info
Learn more about HTTP Authentication in the
documentation.
{% endblock %}