Commit Graph
18 Commits
Author SHA1 Message Date
Ralf HaferkampandGitHub a34a3b2a98 Cleanup some oidc related bits (#5751)
* Remove unused code from oidc module

* Use already existing Metadata type for jwks discovery

ocis-pkg/oidc already provides a type for the oidc metadata. Switch to
that instead of defining yet another custom type.

* oidc: Add helper to get IDP metadata
2023-03-07 14:43:42 +01:00
Jörn Friedrich DreyerandGitHub 53d15d329e remove deprecated use of ioutil (#5205)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2022-12-08 14:44:53 +01:00
Willy Kloucek 2d16779652 fix the oidc provider cache 2022-09-16 12:34:12 +02:00
David Christofas 12d42e0074 add missing comments 2022-08-22 14:24:12 +02:00
David Christofas 78d85b683d add missing comments 2022-08-16 12:47:44 +02:00
David Christofas 06ffd9cf8a some more cleaning up 2022-08-12 10:48:21 +02:00
David Christofas ddfc01bff9 refactor unprotected paths check 2022-08-12 10:47:51 +02:00
David Christofas f35c8b9205 clean up the authenticators middlewares 2022-08-12 10:47:48 +02:00
David Christofas e96819bce8 rewrite the auth middleware
The old approach of the authentication middlewares had the problem that when an authenticator could not authenticate a request it would still send it to the next handler, in case that the next one can authenticate it. But if no authenticator could successfully authenticate the request, it would still be handled, which leads to unauthorized access.
2022-08-12 10:47:43 +02:00
Ralf HaferkampandRalf Haferkamp 6e848c7254 Use mutex for lazy init function
To avoid possible threading issues
2022-08-03 12:00:31 +02:00
Ralf HaferkampandRalf Haferkamp 8229567213 Allow to configure the JWKS refresh settings
This exposes a couple for knobs for the jwks keyfunc module to adjust
timeout and refresh intervals.
2022-08-03 12:00:31 +02:00
Ralf HaferkampandRalf Haferkamp eb94530433 Add option to configure access token verification
Allow to switch jwt access token verification and off. Many (most?) IDP
provide JWT encoded access tokens. If ocis is configure to assume jwt
access tokens (access_token_verify_method==jwt) we now properly verify
the tokens signature and a set of standard claims ("exp", "iat" and nbf"
by way of the jwt module's standard verification and "iss" explicitliy).

This change also allows for introduction of other access token verification
mechanism in the future (e.g. through introspection (RFC7662).
2022-08-03 12:00:31 +02:00
Ralf HaferkampandRalf Haferkamp 454cea8a1c Try to verify access_token as JWT and extract expiry
We try to parse the access token as a JWT now. Verifying the signature
using the keys downloaded from the jwks_uri of the IDP. Currently we
only use it to extract the expiry information from the JWT. This could
be reworked to extract other claims from the token for authorization
purposes.

Fixes: #3841
2022-08-03 12:00:31 +02:00
Ralf HaferkampandRalf Haferkamp 0b055ca621 Remove obsolete comment
Token/Userinfo caching is already present since a while
2022-08-03 12:00:31 +02:00
Ralf HaferkampandRalf Haferkamp db634ae062 Remove non-working access_token parsing code
The removed code was broken is serveral ways:
- The key use for verification was always empty
- Using a static key for access_token verification is incompatible
  with key rotation
- The type assertion (which was never hit anyways) to convert
  the return MapClaims to StandardClaims can't really work
So in the end we were always using the default ttl for caching
the userinfo.
2022-07-07 16:18:10 +02:00
Ralf HaferkampandRalf Haferkamp bd4150ab01 Remove reduntant addtion of claims to context 2022-07-07 16:18:10 +02:00
Christian Richter f8f1320501 refactor extensions -> services
Signed-off-by: Christian Richter <crichter@owncloud.com>
2022-06-27 14:05:36 +02:00
Christian Richter 78064e6bab rename folder extensions -> services
Signed-off-by: Christian Richter <crichter@owncloud.com>
2022-06-27 14:05:36 +02:00