Skip to content

Commit e09a82c

Browse files
authored
Merge pull request #29 from StephanEggermont/master
Make the JOSE and subclass header properties accessible via #at: and …
2 parents 63b01fb + 9a45d83 commit e09a82c

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

source/JSONWebToken-Core/JOSEHeader.class.st

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ JOSEHeader >> = aHeader [
2626
^ aHeader hasSameElements: properties
2727
]
2828

29+
{ #category : 'accessing' }
30+
JOSEHeader >> at: aKey [
31+
^ properties at: aKey
32+
]
33+
34+
{ #category : 'accessing' }
35+
JOSEHeader >> at: aKey put: aValue [
36+
properties at: aKey put: aValue
37+
]
38+
2939
{ #category : 'testing' }
3040
JOSEHeader >> hasSameElements: aDictionary [
3141
^ (properties difference: aDictionary) isEmpty
@@ -36,6 +46,17 @@ JOSEHeader >> hash [
3646
^ properties hash
3747
]
3848

49+
{ #category : 'accessing' }
50+
JOSEHeader >> kid [
51+
"Public Key ID"
52+
^ properties at: 'kid'
53+
]
54+
55+
{ #category : 'accessing' }
56+
JOSEHeader >> kid: anObject [
57+
properties at: 'kid' put: anObject
58+
]
59+
3960
{ #category : 'accessing' }
4061
JOSEHeader >> typ [
4162
^ self type

source/JSONWebToken-Core/JWTClaimsSet.class.st

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"
22
A set of specific claims
3+
4+
The registered claim names are: iss, sub, aud, exp, nbf, iat, jti
5+
None of the claims defined are intended to be mandatory to use or implement in all cases, but rather they provide a starting point for a set of useful, interoperable claims.
36
"
47
Class {
58
#name : 'JWTClaimsSet',
@@ -191,11 +194,41 @@ JWTClaimsSet >> issuer: anObject [
191194
self iss: anObject
192195
]
193196

197+
{ #category : 'accessing' }
198+
JWTClaimsSet >> jti [
199+
^ self at: 'jti'
200+
]
201+
202+
{ #category : 'accessing' }
203+
JWTClaimsSet >> jti: aString [
204+
self at: 'jti' put: aString
205+
]
206+
207+
{ #category : 'accessing' }
208+
JWTClaimsSet >> jwtId [
209+
^ self jti
210+
]
211+
212+
{ #category : 'accessing' }
213+
JWTClaimsSet >> jwtId: aString [
214+
self jti: aString
215+
]
216+
194217
{ #category : 'accessing' }
195218
JWTClaimsSet >> mimeType [
196219
^ 'JWT'
197220
]
198221

222+
{ #category : 'accessing' }
223+
JWTClaimsSet >> nbf [
224+
^ self at: 'nbf'
225+
]
226+
227+
{ #category : 'accessing' }
228+
JWTClaimsSet >> nbf: aString [
229+
self at: 'nbf' put: aString
230+
]
231+
199232
{ #category : 'accessing' }
200233
JWTClaimsSet >> nonce [
201234
^ self at: 'nonce'
@@ -206,6 +239,16 @@ JWTClaimsSet >> nonce: anObject [
206239
self at: 'nonce' put: anObject
207240
]
208241

242+
{ #category : 'accessing' }
243+
JWTClaimsSet >> notBefore [
244+
^ self nbf
245+
]
246+
247+
{ #category : 'accessing' }
248+
JWTClaimsSet >> notBefore: aString [
249+
self nbf: aString
250+
]
251+
209252
{ #category : 'accessing' }
210253
JWTClaimsSet >> setClaims: aCollection [
211254
claims := aCollection

0 commit comments

Comments
 (0)