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

Commit 429d0c5

Browse files
committed
More about sessions and back channel support.
1 parent b29ce3a commit 429d0c5

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/oidcmsg/oidc/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ class AuthorizationResponse(oauth2.AuthorizationResponse,
349349
# "nonce": SINGLE_OPTIONAL_STRING,
350350
"access_token": SINGLE_OPTIONAL_STRING,
351351
"token_type": SINGLE_OPTIONAL_STRING,
352-
"id_token": SINGLE_OPTIONAL_IDTOKEN
352+
"id_token": SINGLE_OPTIONAL_IDTOKEN,
353+
# Below is REQUIRED if doing session management
354+
"session_state": SINGLE_OPTIONAL_STRING
353355
})
354356

355357
def verify(self, **kwargs):
@@ -607,7 +609,7 @@ class RegistrationRequest(Message):
607609
"post_logout_redirect_uris": OPTIONAL_LIST_OF_STRINGS,
608610
"frontchannel_logout_uri": SINGLE_OPTIONAL_STRING,
609611
"frontchannel_logout_session_required": SINGLE_OPTIONAL_BOOLEAN,
610-
"backchannel_logout_supported": SINGLE_OPTIONAL_BOOLEAN,
612+
"backchannel_logout_uri": SINGLE_OPTIONAL_STRING,
611613
"backchannel_logout_session_supported": SINGLE_OPTIONAL_BOOLEAN
612614
}
613615
c_default = {"application_type": "web", "response_types": ["code"]}
@@ -900,7 +902,9 @@ def verify(self, **kwargs):
900902
check_char_set(scope, SCOPE_CHARSET)
901903

902904
parts = urlparse(self["issuer"])
903-
if parts.scheme != "https":
905+
if 'allow_http' in kwargs:
906+
pass
907+
elif parts.scheme != "https":
904908
raise SchemeError("Not HTTPS")
905909

906910
if not parts.query and not parts.fragment:
@@ -909,7 +913,7 @@ def verify(self, **kwargs):
909913
raise ValueError('Issuer ID invalid')
910914

911915
if any("code" in rt for rt in self[
912-
"response_types_supported"]) and "token_endpoint" not in self:
916+
"response_types_supported"]) and "token_endpoint" not in self:
913917
raise MissingRequiredAttribute("token_endpoint")
914918

915919
return True

src/oidcmsg/oidc/session.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
logger = logging.getLogger(__name__)
2121

2222

23-
2423
class RefreshSessionRequest(MessageWithIdToken):
2524
c_param = MessageWithIdToken.c_param.copy()
2625
c_param.update({

tests/test_7_session.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ def test_example(self):
9696
lifetime=300))
9797
keyjar = KeyJar()
9898
keyjar.add_kb('', KC_SYM_S)
99+
with pytest.raises(ValueError):
100+
assert csr.verify(keyjar=keyjar)
101+
102+
103+
def test_example_1(self):
104+
_symkey = KC_SYM_S.get(alg2keytype("HS256"))
105+
csr = CheckSessionRequest(
106+
id_token=IDTOKEN.to_jwt(key=_symkey, algorithm="HS256",
107+
lifetime=300))
108+
keyjar = KeyJar()
109+
keyjar.add_kb(ISS, KC_SYM_S)
99110
assert csr.verify(keyjar=keyjar)
100111

101112

0 commit comments

Comments
 (0)