Commit Graph

214 Commits

Author SHA1 Message Date
David Christofas 69ba80562e add unprotected flag to the proxy routes
I added an unprotected flag to the proxy routes which is evaluated by
the authentication middleware. This way we won't have to maintain a
hardcoded list of unprotected paths and path prefixes and we will
hopefully reduce the times we encounter the basic auth prompt by web
browsers.
2022-09-01 12:43:32 +02:00
David Christofas 4d4f3a16e1 refactor proxy code
I refactored the proxy so that we execute the routing before the
authentication middleware. This is necessary so that we can determine
which routes are considered unprotected i.e. which routes don't need
authentication.
2022-09-01 12:43:32 +02:00
Benedikt Kulmann 6fc87613d5 fix: add index.html to unprotected paths 2022-08-26 10:37:46 +02:00
Benedikt Kulmann 9d67ab3292 fix: set /external path prefix to unprotected 2022-08-25 10:47:46 +02:00
Benedikt Kulmann 9c9a81026c fix: add index.html to unprotected paths in auth middleware 2022-08-25 10:39:55 +02:00
David Christofas 0d2b7e350b add missing unprotected paths 2022-08-24 16:32:25 +02:00
David Christofas e65eb15f2c add the settings path to the unprotected paths 2022-08-24 11:04:18 +02:00
David Christofas 28a9bf357e end unprotected path prefixes with a slash 2022-08-24 10:12:34 +05:45
David Christofas 6043e019f4 add the fonts path to the unprotected path prefixes 2022-08-24 10:12:34 +05:45
David Christofas c4881f5736 Merge pull request #4374 from owncloud/rewrite-auth-middleware
[full-ci] Rewrite of the authentication middleware
2022-08-22 16:39:03 +02:00
David Christofas dfe703291f replace strings.Title with cases.Title 2022-08-22 15:26:00 +02:00
David Christofas 12d42e0074 add missing comments 2022-08-22 14:24:12 +02:00
Willy Kloucek 9f2be9f4f9 remove Log prefix from configlog functions 2022-08-22 08:08:18 +02:00
Willy Kloucek e58eaabdeb move config parse error logging into function to ensure new lines and don't parse config for help 2022-08-18 15:27:28 +02:00
Willy Kloucek 60689c9c1a improve unsupervised description 2022-08-18 10:59:35 +02:00
Willy Kloucek 6154466bbc rename extensions to services (leftover occurences) 2022-08-17 15:36:52 +02:00
David Christofas b5ef10dc2b add missing comments and changelog 2022-08-16 16:53:27 +02:00
David Christofas 3f25ca2059 add unprotected path prefix for parallel deployment 2022-08-16 15:45:22 +02:00
David Christofas 905ead629c add unprotected path prefix for external apps 2022-08-16 15:16:48 +02:00
David Christofas 78d85b683d add missing comments 2022-08-16 12:47:44 +02:00
David Christofas 864438b2de add missing unprotected path 2022-08-15 16:04:14 +02:00
David Christofas 3ebfcbff1e add missing unprotected path 2022-08-15 11:38:04 +02:00
David Christofas 5d45f0e856 fix logic of when to add the www-authenticate headers 2022-08-12 10:48:37 +02:00
David Christofas 036c466425 add missing unprotected paths 2022-08-12 10:48:33 +02:00
David Christofas 32f68f91ff add missing www-authentication header on failed authentication 2022-08-12 10:48:29 +02:00
David Christofas d271ae2451 fix some authentication cases 2022-08-12 10:48:25 +02:00
David Christofas 06ffd9cf8a some more cleaning up 2022-08-12 10:48:21 +02:00
David Christofas 9347657370 remove the oidc tests since they aren't testing anything at the moment
I admit it would be better to implement the tests but I tried and it is a bit tricky since we can't mock everything we would need to mock. I'll wan to get these changes in first and later in the near future we should revisit the auth middleware architecture and refactor it a bit more to be more testable and future proof.
2022-08-12 10:48:17 +02:00
David Christofas 17a4e65f08 add tests for the public share auth middleware 2022-08-12 10:48:13 +02:00
David Christofas 7bc1305cb4 add tests for the basic auth middleware 2022-08-12 10:48:09 +02:00
David Christofas ef020920e8 update authentication tests 2022-08-12 10:48:04 +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
Willy Kloucek 94646c8060 add middleware to rewrite the /.well-known/openid-configuration endpoint for external idps 2022-08-05 14:12:01 +02:00
Willy Kloucek 58ccdaca08 improve PROXY_USER_CS3_CLAIM description 2022-08-05 10:47:51 +02:00
Ralf Haferkamp 6e848c7254 Use mutex for lazy init function
To avoid possible threading issues
2022-08-03 12:00:31 +02:00
Ralf Haferkamp 74d9d0f3e0 Apply suggestions from code review
Co-authored-by: Martin <github@diemattels.at>
2022-08-03 12:00:31 +02:00
Ralf 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 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 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 Haferkamp 0b055ca621 Remove obsolete comment
Token/Userinfo caching is already present since a while
2022-08-03 12:00:31 +02:00
Willy Kloucek 8312803c16 improve error log for "could not get user by claim" error 2022-07-19 13:58:39 +02:00
Willy Kloucek e0523796d9 Merge pull request #4204 from rhafer/cleanup
Remove unused BindEnv code
2022-07-15 07:14:06 +02:00
Ralf Haferkamp 946f3e8feb Remove unused BindEnv code
We dropped this in favour of envdecode a while ago.
2022-07-14 16:34:25 +02:00
Ralf Haferkamp 0f257af6e4 Align default login attribute across services
Up to now the builtin lico was using the "username" as the login
attribute, while the proxy (and to some extend the auth-basic) service
tried to uniquely identify users by mail address. This aligns the
default configuration of the services to use the username everywhere.

Fixes: #4039
2022-07-14 14:21:34 +02:00
Martin d2ec1187bc Apply suggestions from code review 2022-07-08 16:03:17 +02:00
Willy Kloucek 02774a5378 add missing config descriptions 2022-07-08 15:32:26 +02:00
Phil Davis af1a29d79f Merge pull request #4116 from owncloud/description_text_fixes
Env variable text fixes
2022-07-07 20:30:55 +05:45
Ralf 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