Skip to content

Dummy Auth provider

Description

This auth provider allows to sign-in with any username and password, and and then issues an access token.

After successful auth, username is saved to backend database. It is then used for creating audit records for any object change, see changed_by field.

Interaction schema

sequenceDiagram
participant "Client"
participant "Backend"

activate "Client"
alt Successful case
"Client" ->> "Backend"  : login + password
"Backend" ->> "Backend" : Password is completely ignored
"Backend" ->> "Backend" : Check user in internal backend database
"Backend" ->> "Backend" : Create user if not exist
"Backend" ->> "Client"  : Generate and return access_token

else User is blocked
"Client" ->> "Backend"  : login + password
"Backend" ->> "Backend" : Password is completely ignored
"Backend" ->> "Backend" : Check user in internal backend database
"Backend" --x "Client"  : 401 Unauthorized

else User is deleted
"Client" ->> "Backend"  : login + password
"Backend" ->> "Backend" : Password is completely ignored
"Backend" ->> "Backend" : Check user in internal backend database
"Backend" --x "Client"  : 404 Not found
end

alt Successful case
"Client" ->> "Backend"  : access_token
"Backend" ->> "Backend" : Validate token
"Backend" ->> "Backend" : Check user in internal backend database
"Backend" ->> "Backend" : Get data
"Backend" ->> "Client"  : Return data

else Token is expired
"Client" ->> "Backend"  : access_token
"Backend" ->> "Backend" : Validate token
"Backend" --x "Client"  : 401 Unauthorized

else User is blocked
"Client" ->> "Backend"  : access_token
"Backend" ->> "Backend" : Validate token
"Backend" ->> "Backend" : Check user in internal backend database

else
"Client" ->> "Backend"  : access_token
"Backend" ->> "Backend" : Validate token
"Backend" ->> "Backend" : Check user in internal backend database
"Backend" --x "Client"  : 404 Not found
end

deactivate "Client"

Configuration

DummyAuthProviderSettings

Settings for DummyAuthProvider.

Examples:

config.yml
auth:
  provider: horizon.backend.providers.auth.dummy.DummyAuthProvider
  access_token:
    secret_key: secret

Parameters:

  • access_token

    (JWTSettings) –

    Access-token related settings

JWTSettings

Settings related to JWT tokens.

Examples:

config.yml
auth:
  access_token:
    secret_key: somesecret
    expire_seconds: 3600  # 1 hour

Parameters:

  • secret_key

    (SecretStr) –

    Secret key for signing JWT tokens.

    Can be any string. It is recommended to generate random value for every application instance.

  • security_algorithm

    (str, default: 'HS256' ) –

    Algorithm used for signing JWT tokens.

    See authlib documentation.

  • expire_seconds

    (int, default: 36000 ) –

    Token expiration time, in seconds