-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathrp_handler_config.py
More file actions
50 lines (40 loc) · 1.62 KB
/
rp_handler_config.py
File metadata and controls
50 lines (40 loc) · 1.62 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
import json
import sys
from cryptojwt.utils import qualified_name
from idpyoidc.client.configure import RPHConfiguration
from idpyoidc.client.rp_handler import RPHandler
from idpyoidc.configure import create_from_config_file
def display(rp, id):
print(10 * '*' + " "+ id+ " " + 10 * '*')
print(10 * '=' + "CLIENT" + 10 * '=')
_context = rp.client_get("service_context")
_info = {
"base_url": _context.base_url,
"httpc_params": _context.httpc_params,
}
if rp.extra:
_info["extras"] = rp.extra
print(json.dumps(_info, indent=4, sort_keys=True))
print(10 * '=' + "GLOBAL METADATA" + 10 * '=')
print(json.dumps(_context.metadata, indent=4, sort_keys=True))
print(10 * '=' + "GLOBAL USAGE" + 10 * '=')
print(json.dumps(_context.usage, indent=4, sort_keys=True))
print(10 * '=' + "SERVICES" + 10 * '=')
_info = {}
_services = rp.client_get("services")
for srv, item in _services.db.items():
_data = {"class": qualified_name(item.__class__)}
for attr in ["claims", "usage", "default_request_args", "callback_uri"]:
_val = getattr(item, attr)
if _val:
_data[attr] = _val
_info[srv] = _data
print(json.dumps(_info, indent=4, sort_keys=True))
if _context.add_on:
print(10 * '=' + "ADD_ON" + 10 * '=')
print(json.dumps(_context.add_on, indent=4, sort_keys=True))
configuration = create_from_config_file(RPHConfiguration, filename=sys.argv[1])
rp_handler = RPHandler(config=configuration)
rp = rp_handler.init_client('flask_provider')
display(rp, "flask_provider")