You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change proposes the use of concrete struct types for Claims and descendant types, instead of interfaces. By usage of generics, we can let callers replace the standard types with custom type that carry additional properties. This would be a breaking change for the next branch.
rp package
In the rp package the following function will change their signature:
Above type parameters between square brackets ([]) define the minimum set of methods required to check validity of token claims. Aka, constraints. The existing Claims interfaces will be reused and supplemented with 2 methods:
GetSignatureAlgorithm() jose.SignatureAlgorithm migrated from IDTokenClaims
SetSignatureAlgorithm(jose.SignatureAlgorithm) migrated from ClaimsSignature
Although both methods are not required in all use-cases of Claims all the current existing implementations of Claims currently carry the signatureAlg field.
A new interface AccessTokenHashClaims with the GetAccessTokenHash() string method migrated from IDTokenClaims . Finally oidc will carry the following interface definitions, used as constraints:
This change proposes the use of concrete struct types for
Claims
and descendant types, instead of interfaces. By usage of generics, we can let callers replace the standard types with custom type that carry additional properties. This would be a breaking change for thenext
branch.rp package
In the
rp
package the following function will change their signature:op package
In the
op
package the following functions will change their signature:oidc package
Above type parameters between square brackets (
[]
) define the minimum set of methods required to check validity of token claims. Aka, constraints. The existingClaims
interfaces will be reusedand supplemented with 2 methods:GetSignatureAlgorithm() jose.SignatureAlgorithm
migrated fromIDTokenClaims
SetSignatureAlgorithm(jose.SignatureAlgorithm)
migrated fromClaimsSignature
Although both methods are not required in all use-cases of
Claims
all the current existing implementations ofClaims
currently carry thesignatureAlg
field.A new interface
AccessTokenHashClaims
with theGetAccessTokenHash() string
method migrated fromIDTokenClaims
. Finallyoidc
will carry the following interface definitions, used as constraints:The following interfaces can now be removed (their names will be reused):
AccessTokenClaims
IDTokenClaims
UserInfo
UserInfoProfile
UserInfoEmail
UserInfoPhone
UserInfoAddress
UserInfoSetter
UserInfoProfileSetter
In place, we will export the currently private struct types by taking the above names.
Example usage
If users want
VerifyIDToken
to return the predefinedIDTokenClaims
struct type:Or if their token caries additional claims, they can extend the type by struct embedding to gain direct access to those claims:
The text was updated successfully, but these errors were encountered: