gws.base.database.auth_provider

Base authorization provider that checks users with SQL queries.

Source code: gws.base.database.auth_provider

Module Contents

class gws.base.database.auth_provider.Config

Bases: gws.base.auth.provider.Config

SQL-based authorization provider

authorizationSql: str

SQL query that checks user credentials.

dbUid: str | None

UID of the database provider.

getUserSql: str

SQL query that returns the user record for the {uid} placeholder.

class gws.base.database.auth_provider.Object

Bases: gws.base.auth.provider.Object

Authorization provider that checks credentials and loads users with SQL queries.

authorizationSql: str

SQL query that checks user credentials.

db: gws.DatabaseProvider

Database provider the queries run on.

getUserSql: str

SQL query that returns the record of a user by uid.

authenticate(method, credentials)
configure()
configure_provider()

Set the database provider from the configuration.

Returns:

True if a provider was found.

Raises:

gws.Error – If no matching database provider is configured.

get_user(local_uid)
class gws.base.database.auth_provider.Placeholders

Bases: gws.Enum

Placeholder names available in the SQL queries.

password = 'password'

Password from the credentials.

token = 'token'

Token from the credentials.

uid = 'uid'

Local user id, used in getUserSql.

username = 'username'

User name from the credentials.