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

Commit b1e80b9

Browse files
committed
Device flow messages.
Bumped version.
1 parent 4114123 commit b1e80b9

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

src/oidcmsg/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'Roland Hedberg'
2-
__version__ = '0.6.8'
2+
__version__ = '0.6.9'
33

44

55
VERIFIED_CLAIM_PREFIX = '__verified'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from oidcmsg import oidc
2+
from oidcmsg.exception import MissingRequiredAttribute
3+
from oidcmsg.message import Message
4+
from oidcmsg.message import SINGLE_OPTIONAL_INT
5+
from oidcmsg.message import SINGLE_OPTIONAL_STRING
6+
from oidcmsg.message import SINGLE_REQUIRED_INT
7+
from oidcmsg.message import SINGLE_REQUIRED_STRING
8+
9+
10+
class AuthorizationRequest(Message):
11+
c_param = {
12+
"client_id": SINGLE_REQUIRED_STRING,
13+
"scope": SINGLE_OPTIONAL_STRING,
14+
}
15+
16+
17+
class AuthorizationResponse(Message):
18+
c_param = {
19+
"device_code": SINGLE_REQUIRED_STRING,
20+
"user_code": SINGLE_REQUIRED_STRING,
21+
"verification_uri": SINGLE_REQUIRED_STRING,
22+
"verification_uri_complete": SINGLE_OPTIONAL_STRING,
23+
"expires_in": SINGLE_REQUIRED_INT,
24+
"interval": SINGLE_OPTIONAL_INT,
25+
}
26+
27+
28+
class AccessTokenRequest(oidc.AccessTokenRequest):
29+
def verify(self, **kwargs):
30+
super(AccessTokenRequest, self).verify(**kwargs)
31+
32+
if "device_code" in self:
33+
# then both client_id and grant_type MUST be present
34+
for claim in ["grant_type", "client_id"]:
35+
if claim not in self:
36+
raise MissingRequiredAttribute(claim)

0 commit comments

Comments
 (0)