Commit graph

201 commits

Author SHA1 Message Date
Tim Möhlmann
f6cb47fbbb resolve typo comments 2023-09-27 10:03:03 +03:00
Tim Möhlmann
a49ad31735 server options 2023-09-25 20:02:11 +03:00
Tim Möhlmann
e9c494041c add withClient unit test 2023-09-25 19:32:01 +03:00
Tim Möhlmann
abb0bb0d09 review server interface docs and spelling 2023-09-25 18:58:09 +03:00
Tim Möhlmann
d17e452122 finish http unit tests 2023-09-25 18:18:40 +03:00
Tim Möhlmann
f9a4b82b3b change code exchange route test 2023-09-25 12:18:14 +03:00
Tim Möhlmann
b7cbe15ced handle client credentials in VerifyClient 2023-09-25 12:06:25 +03:00
Tim Möhlmann
d27be590c4 unit test authorize 2023-09-22 16:52:32 +03:00
Tim Möhlmann
a88181b611 move server routest test 2023-09-22 14:44:34 +03:00
Tim Möhlmann
b12bb7a1f1 cleanup tokenHandler 2023-09-22 14:40:56 +03:00
Tim Möhlmann
57e8b19a8b unit tests for error handling 2023-09-22 10:02:11 +03:00
Tim Möhlmann
6f45991600 remove unuse ValidateAuthRequestV2 function 2023-09-22 07:57:42 +03:00
Tim Möhlmann
46839e095b run integration tests against both Server and Provider 2023-09-21 19:15:03 +03:00
Tim Möhlmann
af2d2942a1 copy and modify the routes test for the legacy server 2023-09-21 18:13:38 +03:00
Tim Möhlmann
c98291a6a7 check if client credential client is authenticated 2023-09-21 12:19:03 +03:00
Tim Möhlmann
aae3492f7b input validation and concrete handlers 2023-09-20 21:45:06 +03:00
Tim Möhlmann
81d42b061d define handlers, routes 2023-09-13 19:13:53 +03:00
Tim Möhlmann
fe3f98a4f9 rewrite auth request validation 2023-09-13 18:03:50 +03:00
Tim Möhlmann
f4dac05713 error handling 2023-09-12 11:17:59 +03:00
Tim Möhlmann
6993769f06 implement remaining server methods 2023-09-11 17:34:27 +03:00
Tim Möhlmann
2b08c53e49 implement remaining token grant type methods 2023-09-11 16:31:31 +03:00
Tim Möhlmann
2902a81161 intermediate commit with some methods implemented 2023-09-08 10:42:27 +03:00
Tim Möhlmann
4fcda01738 refelct the format from the proposal 2023-09-06 15:59:56 +03:00
Tim Möhlmann
c340ed9ed5 complete interface docs 2023-09-05 00:28:03 +03:00
Tim Möhlmann
cf3a87c4c3 allow any response type 2023-09-05 00:05:09 +03:00
Tim Möhlmann
d6a9c0bbb9 first draft of a new server interface 2023-09-04 23:33:51 +03:00
Tim Möhlmann
daf82a5e04
chore(deps): migrage jose to go-jose/v3 (#433)
closes #390
2023-09-01 14:33:16 +03:00
Tim Möhlmann
0879c88399
feat: add slog logging (#432)
* feat(op): user slog for logging

integrate with golang.org/x/exp/slog for logging.
provide a middleware for request scoped logging.

BREAKING CHANGES:

1. OpenIDProvider and sub-interfaces get a Logger()
method to return the configured logger;
2. AuthRequestError now takes the complete Authorizer,
instead of only the encoder. So that it may use its Logger() method.
3. RequestError now takes a Logger as argument.

* use zitadel/logging

* finish op and testing
without middleware for now

* minimum go version 1.19

* update go mod

* log value testing only on go 1.20 or later

* finish the RP and example

* ping logging release
2023-08-29 14:07:45 +02:00
Tim Möhlmann
e8262cbf1f
chore: cleanup unneeded device storage methods (#399)
BREAKING CHANGE, removes methods from DeviceAuthorizationStorage:

- GetDeviceAuthorizationByUserCode
- CompleteDeviceAuthorization
- DenyDeviceAuthorization

The methods are now moved to examples as something similar can be
userful for implementers.
2023-05-26 10:06:33 +02:00
Tim Möhlmann
8dff7ddee0 Merge branch 'main' into main-to-next 2023-04-18 12:32:04 +03:00
Tim Möhlmann
8730a1685e
feat: custom endpoint for device authorization (#368) 2023-04-13 11:25:49 +02:00
Tim Möhlmann
44f8403574
feat: get issuer from context for device auth (#363)
* feat: get issuer from context for device auth

* use distinct UserFormURL and UserFormPath

- Properly deprecate UserFormURL and default to old behaviour,
to prevent breaking change.

- Refactor unit tests to test both cases.

* update example
2023-04-11 20:29:17 +02:00
Tim Möhlmann
057538d555
fix: resolve nil pointer panic in Authorize (#358)
When ParseAuthorizeRequest received an invalid URL,
for example containing a semi-colon `;`,
AuthRequestError used to panic.
This was because a typed nil was passed as a interface argument.
The nil check inside AuthRequestError always resulted in false,
allowing access through the nil pointer.

Fixes #315
2023-04-05 10:02:37 +02:00
Livio Spring
c72aa8f9a1
fix: use Form instead of PostForm in ClientIDFromRequest (#360) 2023-04-04 13:45:30 +02:00
Livio Spring
dc2bdc6202
fix: improve error handling when getting ClientIDFromRequest (#359) 2023-04-04 12:48:18 +02:00
Tim Möhlmann
b7d18bfd02
chore: document non-standard glob client (#328)
* op: correct typo

rename checkURIAginstRedirects to checkURIAgainstRedirects

* chore: document standard deviation when using globs

add example on how to toggle the underlying
client implementation based on DevMode.

---------

Co-authored-by: David Sharnoff <dsharnoff@singlestore.com>
2023-03-28 14:58:57 +03:00
Tim Möhlmann
adebbe4c32
chore: replace gorilla/schema with zitadel/schema (#348)
Fixes #302
2023-03-28 14:57:27 +03:00
David Sharnoff
c9555c7f1b
feat: add CanSetUserinfoFromRequest interface (#347) 2023-03-24 18:55:41 +02:00
Tim Möhlmann
33c716ddcf
feat: merge the verifier types (#336)
BREAKING CHANGE:

- The various verifier types are merged into a oidc.Verifir.
- oidc.Verfier became a struct with exported fields

* use type aliases for oidc.Verifier

this binds the correct contstructor to each verifier usecase.

* fix: handle the zero cases for oidc.Time

* add unit tests to oidc verifier

* fix: correct returned field for JWTTokenRequest

JWTTokenRequest.GetIssuedAt() was returning the ExpiresAt field.
This change corrects that by returning IssuedAt instead.
2023-03-22 19:18:41 +02:00
Tim Möhlmann
c8cf15e266 upgrade this module to v3 2023-03-20 13:38:21 +02:00
Tim Möhlmann
57fb9f77aa
chore: replace gorilla/mux with go-chi/chi (#332)
BREAKING CHANGE:
The returned router from `op.CreateRouter()` is now a `chi.Router`

Closes #301
2023-03-17 16:36:02 +01:00
Tim Möhlmann
0476b5946e Merge branch 'next' into main-next
prepare the merge of next into main by resolving merge conflicts.
2023-03-15 16:26:32 +02:00
Tim Möhlmann
26d8e32636
chore: test all routes
Co-authored-by: David Sharnoff <dsharnoff@singlestore.com>
2023-03-15 14:32:14 +01:00
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
Tim Möhlmann
4bd2b742f9 chore: remove unused context in NewOpenIDProvider
BREAKING CHANGE:

- op.NewOpenIDProvider
- op.NewDynamicOpenIDProvider

The call chain of above functions did not use the context anywhere.
This change removes the context from those fucntion arguments.
2023-03-08 16:49:12 +02:00
David Sharnoff
7e5798569b
fix: glob support for RedirectURIs
Fixes #293
2023-03-06 14:13:35 +02:00
Tim Möhlmann
4dca29f1f9
fix: use the same schema encoder everywhere (#299)
properly register SpaceDelimitedArray for all instances
of schema.Encoder inside the oidc framework.

Closes #295
2023-03-02 14:24:44 +01:00
David Sharnoff
1eb4ee1c8e auto install things for "go generate" and then clean up afterwards 2023-03-02 11:27:12 +02:00
David Sharnoff
0c74bd51db breaking change: rename GetKeyByIDAndUserID -> GetKeyByIDAndClientID 2023-03-02 11:24:46 +02:00
David Sharnoff
f447b9b6d4 breaking change: Add GetRefreshTokenInfo() to op.Storage 2023-03-02 11:24:46 +02:00