zitadel-oidc/pkg/oidc
Tim Möhlmann dea8bc96ea
refactor: use struct types for claim related types (#283)
* oidc: add regression tests for token claim json

this helps to verify that the same JSON is produced,
after these types are refactored.

* refactor: use struct types for claim related types

BREAKING CHANGE:
The following types are changed from interface to struct type:

- AccessTokenClaims
- IDTokenClaims
- IntrospectionResponse
- UserInfo and related types.

The following methods of OPStorage now take a pointer to a struct type,
instead of an interface:

- SetUserinfoFromScopes
- SetUserinfoFromToken
- SetIntrospectionFromToken

The following functions are now generic, so that type-safe extension
of Claims is now possible:

- op.VerifyIDTokenHint
- op.VerifyAccessToken
- rp.VerifyTokens
- rp.VerifyIDToken

- Changed UserInfoAddress to pointer in UserInfo and
IntrospectionResponse.
This was needed to make omitempty work correctly.
- Copy or merge maps in IntrospectionResponse and SetUserInfo

* op: add example for VerifyAccessToken

* fix: rp: wrong assignment in WithIssuedAtMaxAge

WithIssuedAtMaxAge assigned its value to v.maxAge, which was wrong.
This change fixes that by assiging the duration to v.maxAgeIAT.

* rp: add VerifyTokens example

* oidc: add standard references to:

- IDTokenClaims
- IntrospectionResponse
- UserInfo

* only count coverage for `./pkg/...`
2023-03-10 16:31:22 +02:00
..
grants chore(linting): apply gofumpt & goimports to all .go files (#225) 2022-10-05 09:33:10 +02:00
regression_data refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
authorization.go chore(linting): apply gofumpt & goimports to all .go files (#225) 2022-10-05 09:33:10 +02:00
code_challenge.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
device_authorization.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
discovery.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
error.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
introspection.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
introspection_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
jwt_profile.go chore(linting): apply gofumpt & goimports to all .go files (#225) 2022-10-05 09:33:10 +02:00
keyset.go chore(linting): apply gofumpt & goimports to all .go files (#225) 2022-10-05 09:33:10 +02:00
keyset_test.go add missing import 2022-01-28 09:48:37 +01:00
regression_assert_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
regression_create_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
regression_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
revocation.go feat: Token Revocation, Request Object and OP Certification (#130) 2021-11-02 13:21:35 +01:00
session.go chore(linting): apply gofumpt & goimports to all .go files (#225) 2022-10-05 09:33:10 +02:00
token.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
token_request.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
token_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
types.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
types_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
userinfo.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
userinfo_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
util.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
util_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
verifier.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00