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

Commit 9381db1

Browse files
committed
Updated HTML precursors to be more versatile.
1 parent 30250dc commit 9381db1

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

flask_rp/templates/opresult.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h3>User information</h3>
2727
</dl>
2828

2929
{% if check_session_iframe is defined %}
30-
<iframe id="rp_iframe" src="/session_iframe" hidden></iframe>
30+
<iframe id="rp_iframe" src={{ status_check_iframe }} hidden></iframe>
3131
<iframe id="op_iframe" src={{ check_session_iframe }} hidden></iframe>
3232
{% endif %}
3333

flask_rp/templates/rp_iframe.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
var client_id = {{ client_id }};
1111
var session_state = {{ session_state }};
1212
console.log("RP session state: " + session_state);
13-
var targetOrigin = {{ issuer }}.replace(/\/$/, "");
13+
var targetOrigin = new URL({{ issuer }}).origin;
1414

1515
var stat = "unchanged";
1616
var mes = client_id + " " + session_state;
@@ -32,9 +32,8 @@
3232
}
3333
stat = e.data;
3434

35-
if (stat == "changed") {
35+
if (stat === "changed") {
3636
clearInterval(timer_id);
37-
alert("Your session has changed, you will be redirected to log in again.");
3837
window.parent.window.location = {{ session_change_url }};
3938
}
4039
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
3+
4+
<html>
5+
<head>
6+
<title>pyoidc RP</title>
7+
</head>
8+
<body>
9+
10+
<h1>Session verification</h1>
11+
<h2>Checking that the session hasn't changed!</h2>
12+
13+
<iframe id="op_iframe" src={check_session_iframe} hidden></iframe>
14+
<iframe id="rp_iframe" src={status_check_iframe} hidden></iframe>
15+
16+
</body>
17+
</html>

flask_rp/views.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ def finalize(op_hash, request_args):
133133
}
134134
except KeyError:
135135
kwargs = {}
136+
else:
137+
kwargs["status_check_iframe"] = rp.service_context.add_on['status_check']
136138

137139
kwargs['logout_url'] = "{}/logout".format(rp.service_context.base_url)
138140

@@ -182,14 +184,15 @@ def session_iframe(): # session management
182184
'session_change_url': session_change_url
183185
}
184186
logger.debug('rp_iframe args: {}'.format(args))
185-
186-
return render_template('rp_iframe.html', **args)
187+
_template = _rp.service_context.add_on["status_check"]["session_iframe_template_file"]
188+
return render_template(_template, **args)
187189

188190

189191
@oidc_rp_views.route('/session_change')
190192
def session_change():
191193
logger.debug('session_change: {}'.format(session['op_hash']))
192194
_rp = get_rp(session['op_hash'])
195+
193196
# If there is an ID token send it along as a id_token_hint
194197
_aserv = _rp.service_context.service['authorization']
195198
request_args = {"prompt": "none"}

0 commit comments

Comments
 (0)