Configuration

The following configuration values are used internally. Some of them can be configured using environment variables.

SECRET_KEY

It is used to cryptographically sign each JSON Web Token. Beside that, it is used to securely sign session cookies. This is mandatory for the authorization mechanism to work.

This can be setup with the SRK_SECRET_KEY environment variable.

Default: None

SQLALCHEMY_DATABASE_URI

The database URI where this app should connect. This can be setup with the SRK_DATABASE_URI environment variable. Below an example:

postgresql://coyote:12345@localhost/mydatabase

Default: None

SERVER_NAME

This can be setup with the SRK_SERVER_NAME environment variable.

Default: None

JWT_ALGORITHM

The digital signature algorithm used to sign JWTs. Under the hood, PyJWT is used to generate the tokens, so read the documentation to see what cryptographic algorithms are available.

Default: 'HS256'

JWT_LEEWAY

Default: timedelta(seconds=10)

JWT_EXPIRATION_DELTA

Defaul: timedelta(seconds=300)

JWT_AUTH_HEADER_PREFIX

The prefix for the Authorization request header. If the value of this header in the current request has a different prefix the toke will be considered invalid.

Default: 'JWT'

JWT_ISSUER

This value is used to setup the iss claim of JSON Web Tokens.

Default to the value of SERVER_NAME, otherwise None.

JWT_REQUIRED_CLAIMS

A list of required claims in a JWT. If one of them is not present, the token will be considered invalid.

Default: ["exp", "iat", "sub"]