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

Commit ee0930f

Browse files
committed
Merge branch 'master' of github.com:IdentityPython/oidcmsg
2 parents fa6abb7 + 6c2c160 commit ee0930f

File tree

5 files changed

+45
-13
lines changed

5 files changed

+45
-13
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: python
2+
python:
3+
- "3.5"
4+
- "3.6"
5+
# command to install dependencies
6+
install:
7+
- pip install -r requirements.txt
8+
# command to run tests
9+
script:
10+
- pytest # or py.test for Python versions 3.5 and below

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,20 @@
11
# oidcmsg
2-
Implementation of OIDC protocol messages
2+
Implementation of OIDC protocol messages.
3+
4+
oidcmsg is the 2nd layer in the
5+
JwtConnect stack (cryptojwt, oidcmsg, oidcservice, oidcrp)
6+
7+
Handles serialising into a couple of formats (jwt, json, urlencoded and dict) and deserialising from said formats.
8+
9+
It also does verification of messages , that is :
10+
11+
+ does all the required parameters have a value
12+
+ are the parameter values of the right type
13+
+ if there is a list of permitted values is a parameter value in that list.
14+
15+
Also implements a **KeyJar** which keeps keys belonging to
16+
different owners. One owner may have many keys.
17+
If some of these keys have a common origin, like described in a JWKS.
18+
Such a set will be kept in a **keyBundle**.
19+
Also implemented in this package.
20+

requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pytest==3.2.5
2+
setuptools==39.0.1
3+
cryptography==2.1.3
4+
cryptojwt==0.3.2
5+
future==0.16.0
6+
Requests==2.18.4

src/oidcmsg/key_bundle.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import time
66

77
import requests
8-
import six
98

109
from cryptography.hazmat.backends import default_backend
1110
from cryptography.hazmat.primitives import serialization
@@ -49,7 +48,7 @@ def harmonize_usage(use):
4948
:param use:
5049
:return: list of usage
5150
"""
52-
if type(use) in six.string_types:
51+
if isinstance(use, str):
5352
return [MAP[use]]
5453
elif isinstance(use, list):
5554
ul = list(MAP.keys())

src/oidcmsg/oidc/__init__.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import inspect
88
import json
99
import logging
10-
import six
1110
import sys
1211
import time
1312

@@ -85,7 +84,7 @@ def idtoken_deser(val, sformat="urlencoded"):
8584

8685
def address_deser(val, sformat="urlencoded"):
8786
if sformat in ["dict", "json"]:
88-
if not isinstance(val, six.string_types):
87+
if not isinstance(val, str):
8988
val = json.dumps(val)
9089
sformat = "json"
9190
elif sformat == "dict":
@@ -95,7 +94,7 @@ def address_deser(val, sformat="urlencoded"):
9594

9695
def claims_deser(val, sformat="urlencoded"):
9796
if sformat in ["dict", "json"]:
98-
if not isinstance(val, six.string_types):
97+
if not isinstance(val, str):
9998
val = json.dumps(val)
10099
sformat = "json"
101100
return Claims().deserialize(val, sformat)
@@ -131,7 +130,7 @@ def msg_list_ser(insts, sformat, lev=0):
131130

132131
def claims_ser(val, sformat="urlencoded", lev=0):
133132
# everything in c_extension
134-
if isinstance(val, six.string_types):
133+
if isinstance(val, str):
135134
item = val
136135
elif isinstance(val, list):
137136
item = val[0]
@@ -161,7 +160,7 @@ def claims_ser(val, sformat="urlencoded", lev=0):
161160

162161
def registration_request_deser(val, sformat="urlencoded"):
163162
if sformat in ["dict", "json"]:
164-
if not isinstance(val, six.string_types):
163+
if not isinstance(val, str):
165164
val = json.dumps(val)
166165
sformat = "json"
167166
return RegistrationRequest().deserialize(val, sformat)
@@ -172,7 +171,7 @@ def claims_request_deser(val, sformat="json"):
172171
if sformat == "urlencoded":
173172
sformat = "json"
174173
if sformat in ["dict", "json"]:
175-
if not isinstance(val, six.string_types):
174+
if not isinstance(val, str):
176175
val = json.dumps(val)
177176
sformat = "json"
178177
return ClaimsRequest().deserialize(val, sformat)
@@ -183,7 +182,7 @@ def dict_deser(val, sformat="json"):
183182
if sformat == "urlencoded":
184183
sformat = "json"
185184
if sformat in ["dict", "json"]:
186-
if not isinstance(val, six.string_types):
185+
if not isinstance(val, str):
187186
val = json.dumps(val)
188187
elif isinstance(val, dict):
189188
return val
@@ -394,7 +393,7 @@ def verify(self, **kwargs):
394393
args["opponent_id"] = self["client_id"]
395394

396395
if "request" in self:
397-
if isinstance(self["request"], six.string_types):
396+
if isinstance(self["request"], str):
398397
# Try to decode the JWT, checks the signature
399398
oidr = OpenIDRequest().from_jwt(str(self["request"]), **args)
400399

@@ -408,7 +407,7 @@ def verify(self, **kwargs):
408407
self["request"] = oidr
409408

410409
if "id_token_hint" in self:
411-
if isinstance(self["id_token_hint"], six.string_types):
410+
if isinstance(self["id_token_hint"], str):
412411
idt = IdToken().from_jwt(str(self["id_token_hint"]), **args)
413412
self["verified_id_token_hint"] = idt
414413

@@ -986,7 +985,7 @@ def jwt_deser(val, sformat="json"):
986985
if sformat == "urlencoded":
987986
sformat = "json"
988987
if sformat in ["dict", "json"]:
989-
if not isinstance(val, six.string_types):
988+
if not isinstance(val, str):
990989
val = json.dumps(val)
991990
sformat = "json"
992991
return JsonWebToken().deserialize(val, sformat)

0 commit comments

Comments
 (0)