-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows for symmetric support of Unsecured JWT. It now works as any other algorithm for both encoding and decoding. Fixes #323.
- Loading branch information
Showing
5 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module JWT | ||
module Algos | ||
module None | ||
# Unsecured JWT | ||
module_function | ||
|
||
SUPPORTED = %w[none].freeze | ||
|
||
def sign(to_sign) | ||
raise EncodeError, 'Signing key not supported for Unsecured JWT' if to_sign.key | ||
'' | ||
end | ||
|
||
def verify(to_verify) | ||
raise VerificationError, 'Signing key not supported for Unsecured JWT' if to_verify.public_key | ||
raise VerificationError, 'Signature should be empty for Unsecured JWT' unless to_verify.signature == '' | ||
true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters