Changes

Jump to navigation Jump to search
55 bytes removed ,  18:35, 1 December 2023
m
Text replacement - "<syntaxhighlight lang="xquery">" to "<pre lang='xquery'>"
With the {{Code|%perm:allow}} annotation, one or more permission strings can be attached to a RESTXQ function:
<pre classlang="brush:'xquery"'>
(:~ Login page (visible to everyone). :)
declare
** {{Code|path}}: Original path of the client request.
** {{Code|method}}: Method of the client request ({{Code|GET}}, {{Code|POST}}, …).
** {{Mark|Added with Version 9.1}}: {{Code|authorization}}: Value of the HTTP Authorization header string; may be empty.
An example:
<pre classlang="brush:'xquery"'>
import module namespace Session = 'http://basex.org/modules/session';
There are numerous ways how users can be authenticated in a web application (via OAuth, LDAP, …). The approach demonstrated on this page is pretty basic and straightforward:
* A login HTML page allows you to enter your credentials (user nameusername, password).
* A login check function checks if the typed in data matches one of the database users. If the input is valid, a session id will be set, and the user will be redirected to the main page. Otherwise, the redirection points back to the login page.
* A logout page deletes the session id.
The following lines of code complete the image:
<pre classlang="brush:'xquery"'>
declare
%rest:path("/login-check")
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu