Skip to content

SQL Backend

The SQL backend authenticates a user with SQL database.

Configurations

As every other backend, the configuration for SQL Backend as well needs to be placed at <customer-project>/didmos2-auth/config/backends. An example configuration below desmonstrates the parameters that need to be configured to use the SQL backend. The customer project needs to define the environment variables mentioned in this example configuration. Please have a look at the OIDC Backend configuration section to know more about how to define the environment variables.

Lets have a look at an example configuration and respective environment variables which needs to be defined in the customer project:

module: didmos2_auth.backends.sql.SqlBackend
name: sql
config:
  login_url: !ENV SATOSA_BE_SQL_LOGIN_URL
  host: !ENV MYSQL_HOSTNAME
  port: !ENV MYSQL_PORT
  username: !ENV MYSQL_USERNAME
  password: !ENV MYSQL_PASSWORD
  database: !ENV MYSQL_DATABASE
  authentication_table: !ENV MYSQL_AUTHENTICATION_TABLE
  login_column: !ENV MYSQL_LOGIN_ATTRIBUTE
  password_column: !ENV MYSQL_PASSWORD_ATTRIBUTE

Lets go through each of the properties as part of this configuration:

Property Description
login_url This is didmos login URL, which means the URL where the didmos2-auth frontend is listening to the requests. This contains the SQL login page and hence this property is mandatory to set. AUTH_HOSTNAME environment variable contains the didmos2-auth host where it is deployed.
host SQL Server host where it is running
port SQL Server port where it is running
username The user from which the SQL Backend should login to the SQL Server
password The password for the SQL Server login user
database The name of the database where the users are located for the SQL Backend authentication
authentication_table The name of the table where the users are located for the SQL Backend authentication
login_column The name of the column where the usernames of the users are stored
password_column The name of the column where the password of the users are stored

The value of any property can be set via environment variables. Then the value of the environment variable will determine the value of the property.

Activating the SQL Backend

The activation of the SAML2 backend, in fact all the backends works in the same way as that defined in the Activating the OIDC Backend section. Therefore, please refer to the Activating the OIDC Backend section to get to know more about activating the SAML2 Backend. However the name of the environment variable used to activate the SAML2 Backend is SATOSA_SQL_ACTIVE.