added OpenID Connect support
This commit is contained in:
6
auth/__init__.py
Normal file
6
auth/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# Copyright (c) 2019. Tobias Kurze
|
||||
from backend.auth.oidc import OIDCAuthentication
|
||||
|
||||
from backend.auth.oidc_config import PROVIDERS
|
||||
|
||||
oidc_auth = OIDCAuthentication(PROVIDERS)
|
||||
11
auth/oidc.py
Normal file
11
auth/oidc.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2019. Tobias Kurze
|
||||
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
|
||||
from backend.auth.oidc_config import PROVIDER_NAME
|
||||
|
||||
|
||||
def oidc_auth_default_provider(self):
|
||||
return self.oidc_auth_orig(PROVIDER_NAME)
|
||||
|
||||
|
||||
OIDCAuthentication.oidc_auth_orig = OIDCAuthentication.oidc_auth
|
||||
OIDCAuthentication.oidc_auth = oidc_auth_default_provider
|
||||
14
auth/oidc_config.py
Normal file
14
auth/oidc_config.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2019. Tobias Kurze
|
||||
from flask_pyoidc.provider_configuration import ClientMetadata, ProviderConfiguration
|
||||
|
||||
REG_RESPONSE_CLIENT_ID = "lrc-test-bibliothek-kit-edu"
|
||||
REG_RESPONSE_CLIENT_SECRET = "d8531b30-0e6b-4280-b611-1e6c8b4911fa"
|
||||
|
||||
CLIENT_METADATA = ClientMetadata(REG_RESPONSE_CLIENT_ID, REG_RESPONSE_CLIENT_SECRET)
|
||||
|
||||
PROVIDER_URL = "https://oidc.scc.kit.edu/auth/realms/kit"
|
||||
PROVIDER_NAME = 'kit_oidc'
|
||||
PROVIDER_CONFIG = ProviderConfiguration(issuer=PROVIDER_URL,
|
||||
client_metadata=CLIENT_METADATA)
|
||||
|
||||
PROVIDERS = {PROVIDER_NAME: PROVIDER_CONFIG}
|
||||
Reference in New Issue
Block a user