sqlite
The SQLite backend allows Radiator to authenticate and authorize users against an SQLite database. SQLite is a lightweight, embedded database that requires no separate server process.
Example
Example configuration of a SQLite backend:
sqlite "SQL_DATABASE_USERS_INTERNAL" {
# Database URL
# url "sqlite:users-internal.sqlite";
# Alternatively, configure a database filename
filename "/var/lib/radiator/db/users-internal/users-internal.sqlite";
# SQL query named "FIND_USER"
query "FIND_USER" {
# SQL statement
statement "SELECT USERID, PASSWORD FROM USERIDS WHERE USERID = ?";
# Query argument binding in order
bindings {
aaa.identity;
}
# Result value mapping
mapping {
user.username = USERID;
user.password = PASSWORD;
}
}
# SQL query named "USER_GROUPS"
query "USER_GROUPS" {
# SQL statement
statement "SELECT groupname FROM groups INNER JOIN group_memberships ON groups.id = group_memberships.group_id INNER JOIN users ON group_memberships.user_id = users.id WHERE username = ?";
# Query argument binding in order
bindings {
aaa.identity;
}
# Result values mapping
mapping {
user.group += groupname;
}
}
}
Configuration Options
url
This attribute specifies the connection string used to establish a connection with the SQLite database.
Example:
url "sqlite:users-internal.sqlite";
filename
Alternative to url for specifying the SQLite database file path directly.
Example:
filename "/var/lib/radiator/db/users-internal.sqlite";
query
This clause defines an SQL query operation that retrieves data from the database. The query clause is configured with a name.
Example configuration of a query:
query "FIND_USER" {
# SQL statement
statement "SELECT USERID, PASSWORD FROM USERIDS WHERE USERID = ?";
# Query argument binding in order
bindings {
aaa.identity;
}
# Result value mapping
mapping {
user.username = USERID;
user.password = PASSWORD;
}
}