UserFromCtx retrieves an IdentityCache from the context. If there is no identity in the context, ErrNotAuthenticated is returned. If an error occurs while resolving the identity (e.g. I/O error), then it will be returned.
(ctx context.Context, r *cache.RepoCache)
| 20 | // If there is no identity in the context, ErrNotAuthenticated is returned. |
| 21 | // If an error occurs while resolving the identity (e.g. I/O error), then it will be returned. |
| 22 | func UserFromCtx(ctx context.Context, r *cache.RepoCache) (*cache.IdentityCache, error) { |
| 23 | id, ok := ctx.Value(identityCtxKey).(entity.Id) |
| 24 | if !ok { |
| 25 | return nil, ErrNotAuthenticated |
| 26 | } |
| 27 | return r.Identities().Resolve(id) |
| 28 | } |
no test coverage detected