Documentation
¶
Index ¶
- func AuthSessionTo(ctx context.Context, session Session) context.Context
- func AuthnMiddleware(authn AuthProvider) func(http.Handler) http.Handler
- func ShareContextTo(ctx context.Context, sc *ShareContext) context.Context
- type Agent
- type AuthProvider
- type Authorizer
- type Principal
- type Resource
- type Session
- type ShareContext
- type User
- type Verb
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthnMiddleware ¶
func AuthnMiddleware(authn AuthProvider) func(http.Handler) http.Handler
func ShareContextTo ¶
func ShareContextTo(ctx context.Context, sc *ShareContext) context.Context
ShareContextTo returns a copy of ctx with sc stored as the share context.
Types ¶
type AuthProvider ¶
type AuthProvider interface {
Authenticate(ctx context.Context, reqHeaders http.Header, query url.Values) (Session, error)
// add auth to upstream requests of a session for upstream service account.
UpstreamAuth(r *http.Request, session Session, upstreamPrincipal Principal) error
}
Responsibilities: - Authenticate:
- a2a requests from ui/cli (human users)
- api requests from users/agents
- Forward auth credentials to upstream agents
type Authorizer ¶
type Authorizer interface {
Check(ctx context.Context, principal Principal, verb Verb, resource Resource) error
}
Authz
type Principal ¶
type Principal struct {
User User
Agent Agent
Claims map[string]any // Raw JWT claims (nil for non-JWT auth)
}
Authn
type ShareContext ¶
type ShareContext struct {
}
ShareContext holds the context derived from a validated X-Share-Token header.
func ShareContextFrom ¶
func ShareContextFrom(ctx context.Context) (*ShareContext, bool)
ShareContextFrom returns the ShareContext stored in ctx, if any.
Click to show internal directories.
Click to hide internal directories.