Versions in this module Expand all Collapse all v0 v0.2.0 Oct 9, 2026 Changes in this version + var ErrClarificationLimit = errors.New("accessserver: clarification round limit reached") + var ErrConflict = errors.New("accessserver: version conflict") + var ErrExists = errors.New("accessserver: already exists") + var ErrInvalidCode = errors.New("accessserver: invalid_code") + var ErrNotFound = errors.New("accessserver: not found") + var ErrResolved = errors.New("accessserver: pending request already resolved") + var ErrRevoked = errors.New("accessserver: presented token revoked") + type AuthTokenRecord struct + Agent string + Exp time.Time + JTI string + MissionS256 string + PS string + PresentedIssuer string + PresentedJTI string + Resource string + Scope string + Subject string + type AuthorizationRequest struct + Agent *aauth.AgentClaims + Claims map[string]any + PS string + Presented aauth.PresentedToken + Resource *aauth.ResourceClaims + Subagent *aauth.AgentClaims + Transcript []Exchange + Upstream aauth.PresentedToken + type Authorizer interface + Authorize func(ctx context.Context, r *AuthorizationRequest) (Decision, error) + type AuthorizerFunc func(ctx context.Context, r *AuthorizationRequest) (Decision, error) + func (f AuthorizerFunc) Authorize(ctx context.Context, r *AuthorizationRequest) (Decision, error) + type Client struct + HTTPClient *http.Client + PreferWaitSeconds int + Signer aauth.ServerSigner + func NewClient(signer aauth.ServerSigner, hc *http.Client) *Client + func (c *Client) Answer(ctx context.Context, pendingURL string, body any) error + func (c *Client) Federate(ctx context.Context, r *personserver.FederationRequest) (*personserver.FederationResponse, error) + func (c *Client) Poll(ctx context.Context, pendingURL string) (*personserver.FederationResponse, error) + type Config struct + AcceptRevocation func(ctx context.Context, caller aauth.ServerCaller) bool + AgentResolver aauth.KeyResolver + AuthTokenTTL time.Duration + Authorizer Authorizer + HTTPClient *http.Client + InsecureSkipIdentifierCheck bool + InteractionURL string + Issuer string + Key crypto.Signer + KeyID string + Limiter aauth.Limiter + Logger *slog.Logger + MaxClarificationRounds int + MaxWait time.Duration + Metadata aauth.ServerMetadata + Notify func(ctx context.Context, p *Pending) + Now func() time.Time + Paths Paths + PendingTTL time.Duration + PublishedKeys []aauth.JWK + Resources func(resource string) bool + Revoker Revoker + ServerResolver aauth.KeyResolver + SignatureWindow time.Duration + Store Store + TokenResolver aauth.KeyResolver + TrustPS func(ctx context.Context, ps string) bool + type Decision struct + Code string + Outcome Outcome + Question *Question + Reason string + RequiredClaims []string + Requirement string + RetryAfter int + Scope string + TTL time.Duration + func Allow(scope string) Decision + func DeferApproval() Decision + func DeferClarification(question string, options ...string) Decision + func DeferInteraction() Decision + func Deny(reason string) Decision + func RequireClaims(names ...string) Decision + type Exchange struct + Answer string + Question string + Time time.Time + Updated bool + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (m *MemoryStore) AuthTokensIssuedAgainst(_ context.Context, iss, jti string) ([]AuthTokenRecord, error) + func (m *MemoryStore) CreatePending(_ context.Context, p *Pending) error + func (m *MemoryStore) IsRevoked(_ context.Context, iss, jti string) (bool, error) + func (m *MemoryStore) Pending(_ context.Context, id string) (*Pending, error) + func (m *MemoryStore) PendingByCode(_ context.Context, code string) (*Pending, error) + func (m *MemoryStore) PendingForResourceToken(_ context.Context, iss, jti string) ([]*Pending, error) + func (m *MemoryStore) RecordAuthToken(_ context.Context, r AuthTokenRecord) error + func (m *MemoryStore) Revoke(_ context.Context, iss, jti string, exp time.Time) error + func (m *MemoryStore) UpdatePending(_ context.Context, p *Pending) error + type Outcome int + const Allowed + const Deferred + const Denied + type Paths struct + JWKS string + Pending string + Revocation string + Token string + func DefaultPaths() Paths + type Pending struct + Agent string + Claims map[string]any + Code string + CodeCanonical string + CodeConsumed bool + CreatedAt time.Time + ExpiresAt time.Time + ID string + InteractionURL string + PS string + Question *Question + QuestionAt time.Time + ReceivedAt time.Time + Request json.RawMessage + RequiredClaims []string + Requirement string + Resource string + ResourceTokenIssuer string + ResourceTokenJTI string + Result *Result + RetryAfter int + Rounds int + Scope string + State State + Transcript []Exchange + Version int64 + func (p *Pending) Open() bool + type Question struct + Options []string + Text string + Timeout int + type Result struct + Body []byte + ContentType string + Status int + type Revoker interface + Revoke func(ctx context.Context, recipient, dwk string, req aauth.RevocationRequest) (*aauth.RevocationResponse, error) + type Server struct + func New(cfg Config) (*Server, error) + func (s *Server) Approve(ctx context.Context, id, scope string) error + func (s *Server) Ask(ctx context.Context, id string, q Question) error + func (s *Server) ConsumeCode(ctx context.Context, code string) (*Pending, error) + func (s *Server) Deny(ctx context.Context, id, reason string) error + func (s *Server) Issuer() string + func (s *Server) JWKS() aauth.JWKS + func (s *Server) Local(ps string) personserver.Federator + func (s *Server) Metadata() aauth.AccessServerMetadata + func (s *Server) PendingRequest(ctx context.Context, id string) (*Pending, error) + func (s *Server) Register(mux *http.ServeMux) + func (s *Server) RevokeAuthToken(ctx context.Context, rec AuthTokenRecord) ([]aauth.RevocationOutcome, error) + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Server) Signer() aauth.ServerSigner + type State string + const StateCancelled + const StateDone + const StateInteracting + const StatePending + type Store interface + AuthTokensIssuedAgainst func(ctx context.Context, iss, jti string) ([]AuthTokenRecord, error) + CreatePending func(ctx context.Context, p *Pending) error + IsRevoked func(ctx context.Context, iss, jti string) (bool, error) + Pending func(ctx context.Context, id string) (*Pending, error) + PendingByCode func(ctx context.Context, code string) (*Pending, error) + PendingForResourceToken func(ctx context.Context, iss, jti string) ([]*Pending, error) + RecordAuthToken func(ctx context.Context, r AuthTokenRecord) error + Revoke func(ctx context.Context, iss, jti string, exp time.Time) error + UpdatePending func(ctx context.Context, p *Pending) error + type TokenRequest struct + AgentToken string + PresentedToken string + ResourceToken string + SubagentToken string + UpstreamToken string