add base auth to hydra admin api

This commit is contained in:
TuxCoder 2020-06-21 11:42:23 +02:00
parent 4be94173d4
commit 78c51b7206
2 changed files with 6 additions and 1 deletions

View file

@ -20,6 +20,8 @@ DOMAIN = 'example.com'
HYDRA_REQUEST_TIMEOUT_SECONDS = 3 HYDRA_REQUEST_TIMEOUT_SECONDS = 3
HYDRA_ADMIN_URL = 'http://127.0.0.1:4445' HYDRA_ADMIN_URL = 'http://127.0.0.1:4445'
HYDRA_ADMIN_USER = 'lenticluar_cloud'
HYDRA_ADMIN_PASSWORD = 'notSecure'
HYDRA_PUBLIC_URL = 'http://127.0.0.1:4444' HYDRA_PUBLIC_URL = 'http://127.0.0.1:4444'
SUBJECT_PREFIX = 'something random' SUBJECT_PREFIX = 'something random'

View file

@ -50,7 +50,10 @@ def init_app(name=None):
app.login_manager = LoginManager(app) app.login_manager = LoginManager(app)
#init hydra admin api #init hydra admin api
hydra_config = hydra.Configuration(app.config['HYDRA_ADMIN_URL']) hydra_config = hydra.Configuration(
app.config['HYDRA_ADMIN_URL'],
username=app.config['HYDRA_ADMIN_USER'],
password=app.config['HYDRA_ADMIN_PASSWORD'])
hydra_client = hydra.ApiClient(hydra_config) hydra_client = hydra.ApiClient(hydra_config)
app.hydra_api = hydra.AdminApi(hydra_client) app.hydra_api = hydra.AdminApi(hydra_client)