zitadel-oidc/pkg/op
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
..
mock refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
applicationtype_enumer.go chore: add enumer for iota-defined types (#197) 2022-07-25 20:06:49 +02:00
auth_request.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
auth_request_test.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
client.go auto install things for "go generate" and then clean up afterwards 2023-03-02 11:27:12 +02:00
client_test.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
config.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
config_test.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
context.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
context_test.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
crypto.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
device.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
device_test.go chore: remove unused context in NewOpenIDProvider 2023-03-08 16:49:12 +02:00
discovery.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
discovery_test.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
endpoint.go chore(linting): apply gofumpt & goimports to all .go files (#225) 2022-10-05 09:33:10 +02:00
endpoint_test.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
error.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
keys.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
keys_test.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
op.go chore: remove unused context in NewOpenIDProvider 2023-03-08 16:49:12 +02:00
probes.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
session.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
signer.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
storage.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
token.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
token_client_credentials.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
token_code.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
token_exchange.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
token_intospection.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
token_jwt_profile.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
token_refresh.go feat(op): dynamic issuer depending on request / host (#278) 2023-02-09 17:10:22 +01:00
token_request.go implement RFC 8628: Device authorization grant 2023-03-01 08:59:17 +01:00
token_revocation.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
verifier_access_token.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
verifier_access_token_example_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
verifier_access_token_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
verifier_id_token_hint.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
verifier_id_token_hint_test.go refactor: use struct types for claim related types (#283) 2023-03-10 16:31:22 +02:00
verifier_jwt_profile.go breaking change: rename GetKeyByIDAndUserID -> GetKeyByIDAndClientID 2023-03-02 11:24:46 +02:00