Skip to content

Commit

Permalink
Request revatoken via machine auth after autoprovsioning user (#4690)
Browse files Browse the repository at this point in the history
To successfully authenticate a user after it was autoprovisioned, we
need to get a valid reva token.

Fixes: #4616
  • Loading branch information
rhafer authored Sep 27, 2022
1 parent 5eaf0df commit e4c28de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-autoprovison-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix authentication for autoprovisioned users

We've fixed an issue in the proxy, which made the first http request of an
autoprovisioned user fail.

https://github.com/owncloud/ocis/issues/4616
4 changes: 4 additions & 0 deletions services/proxy/pkg/middleware/account_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ func (m accountResolver) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if err != nil {
m.logger.Error().Err(err).Msg("Autoprovisioning user failed")
}
user, token, err = m.userProvider.GetUserByClaims(req.Context(), "userid", user.Id.OpaqueId, true)
if err != nil {
m.logger.Error().Err(err).Str("userid", user.Id.OpaqueId).Msg("Error getting token for autoprovisioned user")
}
}

if errors.Is(err, backend.ErrAccountDisabled) {
Expand Down

0 comments on commit e4c28de

Please sign in to comment.