FROST-Server Documentation

Live documentation for the development version.

Authentication and Authorisation

There are many ways to secure webservices. The easiest one is to use an external reverse proxy. Since this can be tricky to set up and is limited in what it can do, FROST offers some simple auth* options.

Auth* has to happen in two places: in the HTTP package and in the MQTT package. To make things flexible, authentication is handled by classes that implement an interface, just like the persistence backends. The interface to be implemented is de.fraunhofer.iosb.ilt.sta.util.AuthProvider.

An example docker-compose file with basic auth set up can be found at: docker-compose-separated-basicauth.yaml

More fine-grained authorisation rules can be configured using:

Using Security Wrappers and Security Validators it is possible define in minute detail what a user is allowed to read, create, update and delete. The rules for this can take into account what the relations are that each Entity has with other Entities, as deep as required. Setting this up correctly is not trivial and a mistake in the authorisation may inadvertently open your data for reading or even editing. Therefore, we strongly recommend you contact us for support if your use case requires fine-grained authorisation.

Roles

FROST-Server asks the AuthProvider if the user has the following roles:

Currently there are two auth packages included: FROST-Server.Auth.Basic and FROST-Server.Auth.Keycloak.

Auth settings

These are generic settings for authentication/authorisation.

Settings for the auth provider class BasicAuthProvider

The BasicAuthProvider needs a database to store its usernames, passwords and user roles. This database can be the same as the database used by the persistence manager, but it can also be a different database. The database has the same structure as described in the DataSourceRealm documentation of Tomcat except with the table and column names in upper case, like the rest of the database. If you let this provider create its database tables (with auth.autoUpdateDatabase) it will create three default users:

You should change these default users! The creation only happens at the moment you first try to authenticate, so do an authentication attempt to have tables created.

The BasicAuthProvider has the following specific settings:

Settings for the auth provider class KeycloakAuthProvider

Keycloak requires a JSON config file. The contents of this file are provided by the Keycloak server. There are three ways to pass this configuration to FROST:

When setting roles for a user, the roles need to be set explicitly for the FROST client. Realm roles do not automatically apply to FROST.

Settings for the UserRoleDecoder class UserRoleDecoderDflt

When auth.registerUserLocally is used in the KeyCloak Auth Provider, this is the default class used for this registration. It checks if the username exist in the userTable.usernameColumn and if not, does an insert on this table/column.

The Projects Plugin comes with its own UserRoleDecoder class.