Skip to content
Snippets Groups Projects
Commit 3ca291b7 authored by Mihai Patrascoiu's avatar Mihai Patrascoiu
Browse files

FTS-1835: Allow FTS-REST to read and store custom configuration options for TokenProviders

parent 23898c81
No related branches found
No related tags found
No related merge requests found
......@@ -119,6 +119,18 @@ def fts3_config_load(path="/etc/fts3/fts3restconfig", test=False):
fts3cfg["fts3.Providers"][provider_url]["client_id"] = client_id
client_secret = parser.get("providers", option + "_ClientSecret")
fts3cfg["fts3.Providers"][provider_url]["client_secret"] = client_secret
# Add custom configuration items for this provider
fts3cfg["fts3.Providers"][provider_url]["custom"] = {}
custom_options_filter = filter(
lambda op: provider_name + "_" in op and "_Client" not in op,
parser.options("providers"),
)
for item in list(custom_options_filter):
fts3cfg["fts3.Providers"][provider_url]["custom"][
item.lstrip(provider_name + "_")
] = parser.get("providers", item)
fts3cfg["fts3.ValidateAccessTokenOffline"] = parser.getboolean(
"fts3", "ValidateAccessTokenOffline", fallback=True
)
......
......@@ -22,6 +22,7 @@ class OIDCmanager:
def __init__(self):
self.clients = {}
self.clients_config = {}
self.config = None
def setup(self, config):
......@@ -46,6 +47,8 @@ class OIDCmanager:
if "introspection_endpoint" not in client.provider_info:
log.warning("{} -- missing introspection endpoint".format(issuer))
self.clients[issuer] = client
# Store custom configuration options for this provider
self.clients_config[issuer] = providers_config[provider]["custom"]
except Exception as ex:
log.warning("Exception registering provider: {}".format(provider))
log.warning(ex)
......
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