-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added class for header algorithm RS256. The class does not yet implem…
…ent the RSA signing. Additionally a switch for checking signature has been added. So it can be used with non-checking in case of RSA
- Loading branch information
Showing
11 changed files
with
41 additions
and
17 deletions.
There are no files selected for viewing
Empty file.
3 changes: 3 additions & 0 deletions
3
source/JSONWebToken-Core.package/JWARSASHA256.class/class/parameterValue.st
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,3 @@ | ||
accessing | ||
parameterValue | ||
^ 'RS256' |
3 changes: 3 additions & 0 deletions
3
source/JSONWebToken-Core.package/JWARSASHA256.class/class/signMessage.withKey..st
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,3 @@ | ||
sign | ||
signMessage: aString withKey: anObject | ||
self notYetImplemented |
11 changes: 11 additions & 0 deletions
11
source/JSONWebToken-Core.package/JWARSASHA256.class/properties.json
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,11 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "JsonWebAlgorithm", | ||
"category" : "JSONWebToken-Core-JSONWebToken-Core", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "JWARSASHA256", | ||
"type" : "normal" | ||
} |
7 changes: 0 additions & 7 deletions
7
source/JSONWebToken-Core.package/JWSCompactSerializer.class/instance/materialize..st
This file was deleted.
Oops, something went wrong.
10 changes: 1 addition & 9 deletions
10
source/JSONWebToken-Core.package/JWSCompactSerializer.class/instance/materialize.key..st
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 |
---|---|---|
@@ -1,11 +1,3 @@ | ||
reading | ||
materialize: aString key: aKeyString | ||
| parts header jws | | ||
parts := $. split: aString. | ||
header := JWSHeader fromJson: (parts at: 1) base64Decoded. | ||
jws := JsonWebSignature new | ||
key: aKeyString; | ||
setProtectedHeader: header. | ||
((jws signatureFor: ($. join: { parts first . parts second })) = parts third base64Decoded asByteArray) ifFalse: [ | ||
Error signal: 'signature does not match' ]. | ||
^ jws payload: (JWTClaimsSet fromJson: parts second base64Decoded) | ||
^ self materialize: aString key: aKeyString checkSignature: true |
11 changes: 11 additions & 0 deletions
11
...Token-Core.package/JWSCompactSerializer.class/instance/materialize.key.checkSignature..st
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,11 @@ | ||
reading | ||
materialize: aString key: aKeyString checkSignature: checkSignature | ||
| parts header jws | | ||
parts := $. split: aString. | ||
header := JWSHeader fromJson: (parts at: 1) base64Decoded. | ||
jws := JsonWebSignature new | ||
key: aKeyString; | ||
setProtectedHeader: header. | ||
checkSignature ifTrue: [ | ||
jws checkSignature: parts ]. | ||
^ jws payload: (JWTClaimsSet fromJson: parts second base64Decoded) |
2 changes: 1 addition & 1 deletion
2
source/JSONWebToken-Core.package/JsonWebSignature.class/class/materializeCompact.key..st
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
materializing | ||
materializeCompact: aString key: aKeyString | ||
^ JWSCompactSerializer new materialize: aString key: aKeyString | ||
^ self materializeCompact: aString key: aKeyString checkSignature: true | ||
|
4 changes: 4 additions & 0 deletions
4
...Token-Core.package/JsonWebSignature.class/class/materializeCompact.key.checkSignature..st
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,4 @@ | ||
materializing | ||
materializeCompact: aString key: aKeyString checkSignature: checkSignature | ||
^ JWSCompactSerializer new materialize: aString key: aKeyString checkSignature: checkSignature | ||
|
3 changes: 3 additions & 0 deletions
3
source/JSONWebToken-Core.package/JsonWebSignature.class/instance/algorithm.st
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,3 @@ | ||
accessing | ||
algorithm | ||
^ self protectedHeader algorithm |
4 changes: 4 additions & 0 deletions
4
source/JSONWebToken-Core.package/JsonWebSignature.class/instance/checkSignature..st
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,4 @@ | ||
signature | ||
checkSignature: parts | ||
((self signatureFor: ($. join: { parts first . parts second })) = parts third base64Decoded asByteArray) ifFalse: [ | ||
Error signal: 'signature does not match' ]. |