MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / resolvePrincipal

Method resolvePrincipal

internal/httpapi/httpapi.go:435–447  ·  view source on GitHub ↗

resolvePrincipal runs the injected auth path. It prefers the scope-aware PrincipalAuthenticator; if only the legacy Authenticator is wired it treats the caller as account-scoped (pre-Slice-5a behavior — no scope ceiling).

(r *http.Request)

Source from the content-addressed store, hash-verified

433// PrincipalAuthenticator; if only the legacy Authenticator is wired it treats
434// the caller as account-scoped (pre-Slice-5a behavior — no scope ceiling).
435func (s *Server) resolvePrincipal(r *http.Request) (*identity.Principal, error) {
436 if s.deps.PrincipalAuthenticator != nil {
437 return s.deps.PrincipalAuthenticator(r)
438 }
439 if s.deps.Authenticator == nil {
440 return nil, fmt.Errorf("authentication unavailable")
441 }
442 u, err := s.deps.Authenticator(r)
443 if err != nil {
444 return nil, err
445 }
446 return &identity.Principal{User: u, Scope: identity.ScopeAccount}, nil
447}

Callers 2

requirePrincipalMethod · 0.95
rateLimitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected