External clients (kiosk terminals, mobile apps, integrations) talk to Webdesk through its REST interface (path /rest/... below the Webdesk context path). This page describes how such a client authenticates, how an API key is created and managed, and how access rights and access right sets define which REST calls it may make. It is intended for system administrators and consultants. The access rights for REST endpoints are independent of the action permissions of the authorization control (see permission types): those control who may open an action in the user interface, whereas the access rights described here control which REST URLs may be called with which HTTP method.
|
Aspect |
Login with a user (session) |
API key |
|---|---|---|
|
Typical use |
Integrations and apps that act on behalf of a Webdesk user |
Devices and systems without a user login, e.g. kiosk terminals |
|
Flow |
|
Every call carries the HTTP header |
|
Authorization |
Access rights of the user's roles (role tab "Access Rights") |
Access rights of the API key (directly on the key and via assigned access right sets) |
If the X-Auth-Token header is set, the call is handled as an API key call, otherwise as a session call. (Only in running mode dev or test is Basic Authentication via the Authorization header accepted as well; it is intended for tests.)
The /rest/auth/login call and a few other public endpoints (e.g. password reset, system time) are not checked by the REST authentication. For browser logins the normal way remains the Webdesk login page; /rest/auth/login is meant for external clients.
External clients that log in with a user need role-based access rights. All access rights and access right sets of all roles held by the logged-in user count. If neither a granting nor a denying right exists for the URL and HTTP method, the call is rejected with 403. A few endpoints intended for every logged-in user (e.g. under /rest/po/systeminfo/, /rest/po/users/, /rest/po/actionpermissions/) are exempt from the rights check; being logged in is sufficient for them. When the user interface itself calls REST endpoints (detected through the Referer), the access rights stored in the respective action apply instead (see below).
An API key can additionally act on behalf of a Webdesk user, e.g. when a kiosk terminal fetches the data of a person after scanning an NFC card. For this, the client sends one of the two headers:
|
Header |
Description |
|---|---|
|
|
ID of the NFC card; the user is the person to whom the card is assigned. |
|
|
UID of the person. |
Restrictions:
The access rights of the key remain decisive even with impersonation; the rights of the identified person do not extend them.
The screens are located in the admin menu under "System" (in the folder "Security"): "API Keys" (list) and "Accessright Sets" (access right sets). Depending on the menu layout of the system, the entry "Accessright Sets" may also appear directly under "System".
The list shows all keys with the columns "API Key" (the key value itself), "API Consumer", "Valid from" and "Valid till"; keys that have been invalidated remain visible. The icon in the first column opens a key, the button "Generate New API Key" creates a new one.
Warning: A new key without an access right set and without its own rights is valid, but may not call a single endpoint (response 403).
Warning: The key value is the secret with which the client identifies itself, and it is displayed in clear text in the list and in the screen. Access to these screens should be restricted accordingly; keys do not belong in documentation, tickets or URLs. For images (/image/...) Webdesk additionally accepts the parameter apiKey, but the header X-Auth-Token is preferable.
If the (valid) key belongs to a kiosk, the confirmation points out that this kiosk will no longer work afterwards. Invalidating or deleting breaks the link between kiosk and key; a new key is generated in the kiosk screen (see below).
For kiosks (menu "Cards and Kiosks" > "Kiosks") Webdesk manages the key itself:
API Consumer = kiosk name) and the default access right set of the kiosk type is assigned to it (see below).|
Property |
Description |
Possible value(s) |
|---|---|---|
|
"Selector" |
Path of the REST endpoint, without context path and without query parameters, starting with |
Text, required |
|
"Privilege" |
Permitted kind of access. For the mapping to the HTTP method see below. |
READ, CREATE, UPDATE, DELETE, FULL |
|
"Deny" |
If checked, the right forbids the access instead of allowing it. |
Yes/No (default: No, the right allows) |
|
HTTP method |
required privilege |
|---|---|
|
GET |
READ |
|
POST |
CREATE |
|
PUT, PATCH |
UPDATE |
|
DELETE |
DELETE |
FULL corresponds to READ, CREATE, UPDATE and DELETE together. Other HTTP methods (e.g. HEAD) cannot be mapped and result in an error response 401.
|
Place |
Effect |
|---|---|
|
API key (sections "Api Key Access Right Sets" and "Api Key Specific Access Rights") |
For calls with |
|
Role (tab "Access Rights" in the role screen, sections "Role Access Right Sets" and "Role Specific Access Rights"; see Roles) |
For session calls of all role holders. The tab is only visible to system administrators and not for derived client roles. |
|
Action (file |
For REST calls that the user interface makes from this action. Cannot be changed in the user interface: the action only displays them in the tab "Access Rights", changes made there are not saved. |
|
Access right set |
Reusable collection of rights that can be assigned to any number of keys and roles. |
In act-descr.xml rights are declared as <accessrights><accessright selector="/rest/po/audit/label/*" privilege="GET"/></accessrights>. The attribute privilege takes one or more HTTP methods separated by commas, e.g. GET,POST. Such rights always allow; denying is not possible.
Warning: Changes to a set affect all keys and roles to which it is assigned.
For kiosk keys, Webdesk creates a set named Default <type> Kiosk Access Right Set on first demand (type = PTM, TA or PTM_TA) and assigns it to the new key. The sets contain (all granting):
|
Selector |
Privilege |
in set |
|---|---|---|
|
|
FULL |
PTM, TA |
|
|
FULL |
PTM, TA |
|
|
FULL |
PTM, TA |
|
|
READ |
PTM, TA |
|
|
FULL |
TA only |
"Default PTM_TA Kiosk Access Right Set" combines the rights of both sets. A set that has been created once is found again by its name; later changes to the default configuration do not change an existing set. However, a set can be edited in "Accessright Sets", which changes the rights of all kiosks of that type.
For an API key call, the rights of the key and of all its sets are merged and checked against the path and HTTP method of the call:
/rest/po/kiosks/4711) is compared with the selectors. Method and required privilege result from the table above.FULL acts like READ, CREATE, UPDATE and DELETE. If a selector allows UPDATE or CREATE, READ is also allowed for that selector (unless READ is denied there).For session calls, the same rules are applied to the rights of the user's roles. Here too, no matching right means 403.
An external terminal is to retrieve person data but change nothing. (The paths are examples; the Swagger UI shows the actual paths of an endpoint.)
Terminal read only./rest/po/persons/*, "Privilege" = READ, "Deny" not checked. Save.Terminal Main Entrance; add the set "Terminal read only" in the section "Api Key Access Right Sets"; save.X-Auth-Token.Result: GET /rest/po/persons/... is answered. POST, PUT or DELETE on the same path, and every call to another path, return 403. If access is to be withdrawn later, it is enough to change the set or to block the key with "Invalidate" (401).
Note: The terminal key in this example is not assigned to a kiosk and therefore cannot use user identification (User-Identification-...). Keys for kiosks are created through the kiosk administration.
|
Response |
Possible causes and what to check |
|---|---|
|
401 (not authenticated) |
|
|
403 (not authorized) |
|
In addition, the service logs a line of the form "Check if api key ... has permission to make a GET call over /rest/..." at debug level for every check. It names the method and path of the call (logger at.workflow.webdesk.po.impl.PoAccessRightServiceImpl).
For calls from browsers originating from a different address, Webdesk sets the CORS headers. The allowed origins are defined in the system parameter allowedOriginsForCORS of the bean SecurityHeadersOptions (screen "Systemparameter"). A request with a matching Origin receives Access-Control-Allow-Origin with that value and Access-Control-Allow-Credentials: true. Entries may contain *, e.g. https://app.example.com or https://*.example.com. Allowed request headers include X-Auth-Token, User-Identification-NfcCard and User-Identification-Useruid. Native apps and terminals do not send an Origin header and are not affected.
Warning: In the delivered default the list is empty. In that case every Origin that is sent is returned unchanged, i.e. every origin is allowed. For systems reachable from the internet, the allowed origins should be entered.
login_process. Keep this in mind when assessing security topics and when adding new POST endpoints.LoginTokenUtils, e.g. for server-side report downloads with user switching) and temporary access via security-key reside in the cache of the respective node. In a cluster, calls that land on another node can therefore fail unless requests are pinned to one node.rest/swagger-ui/index.html in a new window, showing the REST endpoints of Webdesk with their paths, methods and parameters. Calls from the Swagger UI run with the session of the logged-in user. They are permitted for system administrators and for users who have access rights for the endpoint through any of their actions. The Swagger UI is useful for looking up paths for selectors.postman/Webdesk - Public API.postman_collection.json. It contains the call "Login" (POST {{restURL}}/auth/login) and sample calls for time and attendance (absence reasons, own bookings, current state, performing a booking). The variable restURL is not preset in the collection and has to be set to the REST base address of the system (Webdesk address plus /rest). The collection uses the session login, not API keys.