mcpauth

package
v0.4.0-rc.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = xerror.New(xerror.KindNotFound, "MCP_OAUTH_GRANT_MISSING", "OAuth grant is unavailable")

Functions

func CheckActiveGrant

func CheckActiveGrant(ctx context.Context, tx postgres.DBTX, id int64) error

func CheckMachineAdminSession

func CheckMachineAdminSession(ctx context.Context, tx postgres.DBTX, org, user slug.Slug, authenticationVersion int64) error

func ConsumeCredential

func ConsumeCredential(ctx context.Context, tx postgres.DBTX, id int64, hash string) error

func CreateCredential

func CreateCredential(ctx context.Context, tx postgres.DBTX, credential Credential) (time.Time, error)

func CreateMachineGrant

func CreateMachineGrant(ctx context.Context, tx postgres.DBTX, issuance Issuance, lifetimeSeconds int32) (int64, error)

func CreatePendingConsent

func CreatePendingConsent(ctx context.Context, tx postgres.DBTX, pending PendingConsent, nonceHash, sessionHash string, lifetimeSeconds int32) error

func CreateUserGrant

func CreateUserGrant(ctx context.Context, tx postgres.DBTX, issuance Issuance, user, org slug.Slug, authVersion int64, lifetimeSeconds int32, scopeKeys []string) (int64, error)

func DisconnectMachineClient

func DisconnectMachineClient(ctx context.Context, tx postgres.DBTX, issuance Issuance, org, key slug.Slug) error

func DisconnectUserClient

func DisconnectUserClient(ctx context.Context, tx postgres.DBTX, issuance Issuance, user, org slug.Slug) error

func ListUserClients

func ListUserClients(ctx context.Context, db postgres.DBTX, issuance Issuance, user, org slug.Slug,
	version int64, after string, limit int32,
) ([]string, error)

func LockBrowserUser

func LockBrowserUser(ctx context.Context, db postgres.DBTX, user slug.Slug, version int64) error

func LockGrant

func LockGrant(ctx context.Context, tx postgres.DBTX, issuance Issuance, hash, kind string) (int64, error)

func NarrowUserGrantScopes

func NarrowUserGrantScopes(ctx context.Context, tx postgres.DBTX, grantID int64, allowed []string) error

func ReadMachineClientSecretHash

func ReadMachineClientSecretHash(ctx context.Context, db postgres.DBTX, issuance Issuance) (string, error)

func RegisterMachineClient

func RegisterMachineClient(ctx context.Context, tx postgres.DBTX, issuance Issuance, org, key slug.Slug, hash string, lifetimeSeconds int32, scopeKeys []string) (time.Time, error)

func RevokeGrant

func RevokeGrant(ctx context.Context, tx postgres.DBTX, id int64) error

Types

type Credential

type Credential struct {
	Hash, Kind, RedirectURI, Challenge string
	GrantID                            int64
	LifetimeSeconds                    int32
}

type CredentialState

type CredentialState struct {
	RedirectURI, Challenge string
	Used, Unexpired        bool
}

func ReadCredential

func ReadCredential(ctx context.Context, tx postgres.DBTX, id int64, hash string) (CredentialState, error)

type Issuance

type Issuance struct {
	Issuer   string
	Audience string
	ClientID string
	Machine  bool
}

type MachinePrincipal

type MachinePrincipal struct {
	APIKey, Organization slug.Slug
	APIKeyID             int64
	ClientID             string
	ScopeKeys            []string
}

func AuthenticateMachineAccessToken

func AuthenticateMachineAccessToken(ctx context.Context, db postgres.DBTX, issuance Issuance, org slug.Slug, hash string) (MachinePrincipal, error)

type PendingConsent

type PendingConsent struct {
	RedirectURI, Challenge, ClientState string
	GrantID                             int64
}

func ConsumePendingConsent

func ConsumePendingConsent(ctx context.Context, tx postgres.DBTX, issuance Issuance, nonceHash, sessionHash string, user, org slug.Slug, authVersion int64) (PendingConsent, error)

type UserPrincipal

type UserPrincipal struct {
	User, Organization slug.Slug
	UserID, MemberID   int32
	ClientID           string
	ScopeKeys          []string
}

func AuthenticateAccessToken

func AuthenticateAccessToken(ctx context.Context, db postgres.DBTX, issuer, audience, hash string) (UserPrincipal, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL