-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add granularity for DID Token Errors #50
Add granularity for DID Token Errors #50
Conversation
This pull request has been linked to Shortcut Story #67980: Python Admin SDK - split DIDTokenError into 2 error types. |
|
||
Returns: | ||
None. | ||
""" | ||
proof, claim = cls.decode(did_token) | ||
|
||
if claim['ext'] is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this to the validate method!
magic_admin/resources/token.py
Outdated
message='Given DID token cannot be used at this time. Please ' | ||
'check the "ext" field and regenerate a new token with a suitable ' | ||
'value.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the first line could go away. The "at this time" makes me think of a temporal issue vs malformed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call - removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
📦 Pull Request
The
DIDTokenError
is too vague so we split this up intoDIDTokenExpired
,DIDTokenMalformed
, andDIDTokenInvalid
.DIDTokenMalformed
: raised when DID token cannot be decoded or if required fields are missingDIDTokenExpired
: raised when current time > DID Token expiration timeDIDTokenInvalid
: raised when DID token can be decoded but does not pass validation (missing values, signature mismatch, etc.)🗜 Versioning
(Check one!)
✅ Fixed Issues
🚨 Test instructions
Tests pass with
make test
.CHANGELOG.md
Upcoming Changes
section ofCHANGELOG.md
with context related to this Pull Request.