Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Add account uuid extraction middleware #46

Merged
merged 4 commits into from
May 27, 2020
Merged

Conversation

kulmann
Copy link
Member

@kulmann kulmann commented May 26, 2020

Adds a middleware for extracting the account uuid from the x-access-token header and providing it in the context. This can be used in any ocis service that needs the account uuid. It is minted into the x-access-token by the proxy.

There are version incompatibilities that need to be solved... thus creating this as a draft.

@update-docs
Copy link

update-docs bot commented May 26, 2020

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@kulmann kulmann self-assigned this May 26, 2020
@kulmann kulmann requested a review from refs May 26, 2020 14:54
return
}

ctx := context.WithValue(r.Context(), UUIDKey, user.Id.OpaqueId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only piece of feedback I have is that we're tying our data model to Reva here for all consumers of this context. Should we instead deal with the UUID, and not missleadingly store an opaque id under a UUIDKey?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The opaque id is what we previously set in the proxy and is in fact our UUID. Maybe a good idea to have the proxy middleware about the account uuid here in ocis-pkg as well, to make it more transparent what we're doing.

@ownclouders
Copy link

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- account/option.go  1
- middleware/account.go  4
         

See the complete overview on Codacy

@kulmann kulmann changed the title WIP: Add account uuid extraction middleware Add account uuid extraction middleware May 27, 2020
@kulmann kulmann marked this pull request as ready for review May 27, 2020 08:05
@kulmann kulmann merged commit 3242d53 into master May 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the account-uuid-middleware branch May 27, 2020 08:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants