Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Commit cdcd987

Browse files
committed
Added support for session status check as defined in
https://openid.net/specs/openid-connect-session-1_0.html Bumped version.
1 parent b706091 commit cdcd987

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

src/oidcservice/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
__author__ = 'Roland Hedberg'
12-
__version__ = '0.6.4'
12+
__version__ = '0.6.5'
1313

1414

1515
OIDCONF_PATTERN = "{}/.well-known/openid-configuration"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from cryptojwt.utils import as_bytes
2+
3+
4+
def get_session_status_page(service_context, looked_for_state):
5+
"""
6+
Constructs the session status check page
7+
8+
:param service_context: The relying party's service context
9+
:param looked_for_state: Expecting state to be ? (changed/unchanged)
10+
"""
11+
_msg = open(service_context.add_on['status_check']['template_file']).read()
12+
_csi = service_context.provider_info['check_session_iframe']
13+
_mod_msg = _msg.replace("{check_session_iframe}", _csi)
14+
if looked_for_state == "changed":
15+
_mod_msg = _mod_msg.replace(
16+
"{status_check_iframe}",
17+
service_context.add_on['status_check']['session_changed_iframe'])
18+
else:
19+
_mod_msg = _mod_msg.replace(
20+
"{status_check_iframe}",
21+
service_context.add_on['status_check']['session_unchanged_iframe'])
22+
23+
return as_bytes(_mod_msg)
24+
25+
26+
def add_status_check_support(service, template_file, rp_iframe_path,
27+
session_changed_iframe_path, session_unchanged_iframe_path):
28+
"""
29+
Setup status check support.
30+
31+
:param service: Dictionary of services
32+
:param template_file: Name of template file
33+
"""
34+
# Arbitrary which service is used, just want a link to the service context
35+
authn_service = service["authorization"]
36+
authn_service.service_context.add_on['status_check'] = {
37+
"template_file": template_file,
38+
"rp_iframe_path": rp_iframe_path,
39+
"session_changed_iframe": session_changed_iframe_path,
40+
"session_unchanged_iframe": session_unchanged_iframe_path,
41+
# below are functions
42+
# "rp_iframe": rp_iframe,
43+
"get_session_status_page": get_session_status_page
44+
}

0 commit comments

Comments
 (0)