Skip to main content

Authentication

Document loading and Annotation saving

tip

This section refers to loading documents from an REST-Endpoint via HTTP

Basic Auth

Configure application.yml as follows:

webtoolkit:
ddp:
http:
authentication:
- host: localhost
user: myUser
password: myPass

When using host, keep in mind that if you request a document from a specific port, the host part needs to be configured without the port. For example if your endpoint is http://localhost:8080/doc.pdf the host entry in application.yml stays localhost.

You can either set a host or a matching regular expression:

webtoolkit:
ddp:
http:
authentication:
- regex: https?:\/\/(www\.)?levigo\.de(\/.*)?
user: myUser
password: myPass

Bearer Token

JavaScript API

window.viewerApi.clientApi.setAuthenticationInfo("eY...");

Static configuration

Configure application.yml as follows:

webtoolkit:
ddp:
http:
authentication:
- host: localhost
token: eY...

Client Cookies

Configure application.yml as follows:

webtoolkit:
ddp:
http:
authentication:
- host: localhost
cookie: JSESSIONID

This will take the cookie name and value to make requests to the desired HTTP-endpoint

Custom headers

If you want to provide additional headers when requesting documents from an HTTP-endpoint you can achieve this in two ways:

JavaScript API

window.viewerApi.clientApi.setAdditionalHttpHeaders(["X-Powered-By:jadice", "X-My-Header:value"])

Static configuration

Configure application.yml as follows:

webtoolkit:
ddp:
http:
headers:
- host: localhost
header: X-Powered-By
value: jadice