Commit Graph

133 Commits

Author SHA1 Message Date
André Duffeck cbac5f1555 Switch to a different msgpack lib
The current one has a problem handling time.Time{} structs
2025-05-16 10:24:43 +02:00
Ralf Haferkamp dcf78f7f3d proxy(router): Allow to set some outgoing headers
This introduces the "additional_headers", "remote_user_header" and
"skip_x_access_token" config keys to allow configuring routes to
external services that require addtional headers to be set.

"remote_user_header": defines the name of a Header that will carry the
userid of the authenticated user on the outgoing request.

"additional_headers": defines a list of header names and values that will
be added to outgoing requests on matching routes.

"skip_x_access_token": when set to true the reva access token will not
be added to the outgoing request.

Needed for #206
2025-04-30 10:17:58 +02:00
Ralf Haferkamp 102e92fd73 appauth: Add token and user (with roles) to context
When successfully authenticating a user via apptoken, resolve the user's
roles and add the user and the token returned by the auth service to the
request context. Rely on the account_resolve middleware to add the reva
token to the outgoing request as the other auth middlewares do.
2025-04-30 10:17:58 +02:00
Ralf Haferkamp 95f28baa52 Use constant instead of repeating the "x-access-token" string over and over 2025-04-30 10:17:58 +02:00
Ralf Haferkamp 0716b40fa0 Adjust LDAP Schema for new name 2025-01-29 11:58:57 +01:00
André Duffeck e8d35e1280 Use the opencloud reva from now on 2025-01-21 11:16:38 +01:00
Jörn Friedrich Dreyer 747b2879d7 proxy
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-16 17:31:51 +01:00
Ralf Haferkamp 213e9663a9 Rename go-micro services 2025-01-16 09:45:46 +01:00
André Duffeck 8c8cdd9310 Adapt protobuf naming 2025-01-15 11:04:32 +01:00
Jörn Friedrich Dreyer b07b5a1149 use plain pkg module
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 16:42:19 +01:00
Jörn Friedrich Dreyer 8e028f17e9 change module name
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 09:58:18 +01:00
Juan Pablo Villafáñez 69864b8ab9 feat: improve logs when a context is canceled in the proxy 2024-11-19 11:25:40 +01:00
Roman Perekhod 3a060331f7 fixed an idp guest role default assignment 2024-11-07 17:57:01 +01:00
Jörn Friedrich Dreyer 7fd8284daf mark header to not show up as a potential password leak G101
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-10-22 10:57:01 +02:00
André Duffeck bea1deebba Work around a problem with reverse proxies changing URLs being signed
Fixes https://github.com/owncloud/ocis/issues/10180
2024-10-04 09:50:58 +02:00
Ralf Haferkamp cb8934081f proxy(oidc): Emit a UserSignedIn event on new session
Every time the OIDC middleware sees a new access token (i.e when it needs
to update the userinfo cache) we consider that as a new login. In this case
the middleware add a new flag to the context, which is then used by the
accountresolver middleware to publish a UserSignedIn event.
The event needs to be sent by the accountresolver middleware, because only
at that point we know the user id of the user that just logged in.

(It would probably makes sense to merge the auth and account middleware into a
single component to avoid passing flags around via context)
2024-09-17 16:02:47 +02:00
Ralf Haferkamp 109b23966c bump some jwt related go modules to current version
go-jwt/jwt to v5.2.1
MicahParks/keyfunc to v2.1.0
2024-08-26 15:35:15 +02:00
Juan Pablo Villafañez faf162704e Merge pull request #9684 from owncloud/collaboration_improved_tracing
feat: include additional metadata for tracing the collaboration service
2024-08-13 11:35:52 +02:00
jkoberg e7fd04bbe3 feat(tusd): bump tusd pkg to v2.4.0
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-08-07 09:13:50 +02:00
Juan Pablo Villafáñez a5d27b2f98 feat: include additional metadata for tracing the collaboration service 2024-08-05 13:15:12 +02:00
jkoberg 3b3d30159d fix(proxy): fix build after rebase
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-07-23 08:58:07 +02:00
Thomas Müller 7005cbc0fc feat: add unit test for app auth middleware 2024-07-23 08:58:07 +02:00
Thomas Müller 4fa7ea0b20 feat: add cli command to generate app token for user 2024-07-23 08:58:07 +02:00
Thomas Müller 43403edfb8 feat: reva app auth 2024-07-23 08:58:07 +02:00
Jörn Friedrich Dreyer b2255bb3d5 Log user agent and remote addr on auth errors
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-07-16 12:41:04 +02:00
Ralf Haferkamp ff6674f97b Fix fallout of reva bump
reva tries to avoid copying proto messages now. This changed some calls
to take pointers now (mainly e.g. FormatResourceId())
2024-07-11 15:21:56 +02:00
Ralf Haferkamp 0d65908e82 autoprovisioning: sync group memberships
Add support for autoprovisioning group memberships from OIDC claims.
Users are added to and removed from groups based on the value of an OIDC
claim. If a group does not exist, it is created.

Closes: #5538
2024-07-08 09:32:23 +02:00
Michael Barz ccb8228edd fix: bump upstream sec middleware 2024-06-10 17:20:38 +02:00
Roman Perekhod c7281599d4 replacement for TokenInfo endpoint 2024-05-28 09:29:08 +02:00
Ralf Haferkamp 7ca8391ce2 feat(proxy): Update selected attributes of autoprovisioned users
When autoprovisioning is enabled, we now update autoprovisioned users when their
display name or email address claims change.

Closes: #8955
2024-05-15 13:30:45 +02:00
Thomas Müller 4f7480d322 feat: drop github.com/a8m/envsubst in favor of gookit/config (#9028) 2024-04-30 18:05:58 +02:00
Thomas Müller bdbba929d0 feat: add CSP and other security related headers in the oCIS proxy service (#8777)
* feat: add CSP and other security related headers in the oCIS proxy service

* fix: consolidate security related headers - drop middleware.Secure

* fix: use github.com/DeepDiver1975/secure

* fix: acceptance tests

* feat: support env var replacements in csp.yaml
2024-04-26 09:10:35 +02:00
Ralf Haferkamp 8d5a0c6dd8 fix(public-share-auth): allow to create new documents in public share folder
The public share authentication middleware only allowed to open existing documents
the /app/new route was missing.

Fixes #8691
2024-04-15 16:35:13 +02:00
Christian Richter 29549fade7 kill oidc well known middleware and move it to static route
Signed-off-by: Christian Richter <crichter@owncloud.com>
2024-03-18 16:56:10 +01:00
Jörn Friedrich Dreyer 26136f8f81 drop store service in favor of a micro store implementation (#8419)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-02-26 16:08:03 +01:00
Thomas Müller b12cff1016 fix: properly check expiry and verify signature of signed urls (#8385)
fix: signed url expiry validation only checks for expiry and not for used before
2024-02-07 15:44:33 +01:00
Jörn Friedrich Dreyer fad94d2038 bump mockery, add test stub for oidc_auth.go, align mock generation (#8321)
* bump mockery, add test stub for oidc_auth.go

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use .mockery.yaml for all mocks

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* drop legacy go:generate mockery

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* align mock placement

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-02-01 10:07:44 +01:00
Jörn Friedrich Dreyer 45d1936384 verify expiry of cached claims (#8310)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-01-31 14:58:18 +01:00
Michael Barz 14553dd6b1 feat: RED metrics 2023-12-20 14:53:16 +01:00
Andre Duffeck 2284fe388d Also log the traceid alongside the request id (#8023)
* Also log the traceid alongside the request id

* Add changelog
2023-12-20 09:32:57 +01:00
André Duffeck b17fa1d72b Make /remote.php/dav/ocm/ work as well 2023-12-14 09:30:41 +01:00
Jörn Friedrich Dreyer 23e59b5ded Parse role claims (#7713)
* extract and test role claim parsing

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add failing test

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* read segmented roles claim as array and string

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* reuse more code by extracting WalkSegments

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add TestSplitWithEscaping

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* docs and error for unhandled case

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add claims test

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add missing ReadStringClaim docs

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-12-04 12:18:52 +01:00
Florian Schade ad06a192d8 enhancement: add graph beta listPermissions endpoint (#7753)
* enhancement: add graph beta listPermissions endpoint

besides the new api endpoint it includes several utilities to simplify the graph api development.

* resolve drive and item id from the request path
* generic pointer and value utilities
* space root detection

* update GetDriveAndItemIDParam signature to return a error

* move errorcode package

* enhancement: add generic error code handling

* fix: rebase
2023-11-28 17:06:04 +01:00
André Duffeck 668f917dba Add an ocm service exposing the ocm related http and grpc APIs 2023-10-24 10:29:29 +02:00
Ralf Haferkamp dfeff633fa proxy: also set the "Www-Authenticate" header for graph request
There doesn't seem to be a good reason to treat the graph service differently here.
2023-10-16 10:31:39 +02:00
Ralf Haferkamp 951e1e5a09 proxy: Avoid duplicated Www-Authenticate headers
For endpoints in the "ProxyWwwAuthenticate" list we accidently set the Www-Authenticate
header twice.
2023-10-16 10:31:39 +02:00
Ralf Haferkamp 684f5c07e5 Use service user for role assignment and autoprovisioning
This gets us a rid of the need to configure the reva jwt secret in the
proxy. Also we no longer need to fake an internal admin user for
autoprovsioning user and/or assigning the roles to users from oidc
claims.
2023-09-07 20:54:14 +02:00
Jörn Friedrich Dreyer 5422586bfa allow skipping userinfo call
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-08-23 13:56:48 +02:00
Florian Schade 90ba75e27e enhancement: Evaluate policy resource information on single file shares (#6888)
* enhancement: Evaluate policy resource information on single file shares

* enhancement: switch to resource name evaluation for example rego put rule
2023-07-31 12:12:56 +02:00
Daniel Swärd ce4ad80ce2 Remove grpc.DefaultClient() reference from policies and use only one gprc client. 2023-07-28 12:21:02 +02:00