Skip to content
Snippets Groups Projects
Commit 988dd338 authored by Michel Jouvin's avatar Michel Jouvin
Browse files

Merge branch 'auth_source_name' into 'master'

Allow to configure the authentication provider name displayed in login page

Closes #7

See merge request hito/ositah!2
parents 3833b9ec 979913c6
No related branches found
Tags 22.11
No related merge requests found
......@@ -314,14 +314,14 @@ def make_app(environ=None, start_response=None, options=None):
options.configuration_file = default_config_path()
options.debug = True
define_config_params(options.configuration_file)
config = define_config_params(options.configuration_file)
# Despite db is not used directly here, it is important to have it imported once after the
# configuration has been defined and before the app.run_server(in fact the Flaks app.server())
# is executed
from ositah.utils.hito_db import db # noqa: F401
configure_multipass_ldap(app.server, "IJCLab Account")
configure_multipass_ldap(app.server, config["server"]["authentication"]["provider_name"])
multipass.init_app(app.server)
app.server.secret_key = "ositah-dashboard"
......
......@@ -80,6 +80,7 @@ server:
base_dn: 'ou=ijclab,dc=ijclab,dc=in2p3,dc=fr'
bind_dn: 'CN=Non-Interactive Queries,OU=SI,OU=Services techniques,OU=Laboratoire,DC=lal,DC=in2p3,DC=fr'
password: 'ldap_bind_password'
provider_name: "MyLab account"
# Options related to declarations
declaration:
......
......@@ -111,7 +111,7 @@ class OSITAHMultipass(Multipass):
)
def configure_multipass_ldap(app, provider_title: str = "IJCLab Account"):
def configure_multipass_ldap(app, provider_title):
"""
Configure Flask_multipass from configuration. Inspired from Indico and its configuration file.
Required flask_multipass with PR #42.
......
......@@ -287,6 +287,12 @@ def define_config_params(file):
for param in ["uri", "base_dn", "bind_dn", "password"]:
if param not in global_params.ldap:
raise ConfigMissingParam(f"server/authentication/ldap/{param}", file)
else:
raise ConfigMissingParam("server/authentication/ldap", file)
if "provider_name" not in config["server"]["authentication"]:
raise ConfigMissingParam("server/authentication/provider_name", file)
else:
raise ConfigMissingParam("server/authentication", file)
if "hito" not in config:
raise ConfigMissingParam("hito", file)
......
......@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ositah"
version = "22.10"
version = "22.11"
description = "Outils de Suivi d'Activités basé sur Hito"
readme = "README.md"
requires-python = ">=3.8"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment