-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathcontext.py
More file actions
35 lines (29 loc) · 897 Bytes
/
context.py
File metadata and controls
35 lines (29 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import copy
from urllib.parse import quote_plus
from idpyoidc.impexp import ImpExp
def add_issuer(conf, issuer):
res = {}
for key, val in conf.items():
if key == "abstract_storage_cls":
res[key] = val
else:
_val = copy.copy(val)
_val["issuer"] = quote_plus(issuer)
res[key] = _val
return res
class OidcContext(ImpExp):
parameter = {"entity_id": None}
def __init__(self, config=None, entity_id=""):
ImpExp.__init__(self)
if entity_id:
self.entity_id = entity_id
else:
if config:
val = ''
for alt in ['client_id', 'issuer', 'entity_id']:
val = config.get(alt)
if val:
break
self.entity_id = val
else:
self.entity_id = ''