Documentation
¶
Index ¶
- func AppendQuery(raw string, values url.Values) string
- func ConfiguredLoginValue() string
- func ConstantTimeEqual(a, b string) bool
- func EquivalentResourceURI(left, right string) bool
- func NewOAuthManager(store *OAuthStore, signingKey string, accessTTLSeconds int64, ...) *manage.Manager
- func ParseBearerToken(header string) (string, bool)
- func RandomToken(n int) (string, error)
- func ValidPKCEChallenge(challenge string) bool
- func VerifyPKCE(verifier, challenge string) bool
- func WithOAuthRequest(ctx context.Context, issuer, resource, clientID string) context.Context
- type Bearer
- type OAuthClientRegistration
- type OAuthCode
- type OAuthGrant
- type OAuthStore
- func (s *OAuthStore) ClientAllowsGrant(clientID, grantType string) bool
- func (s *OAuthStore) ClientRegistration(clientID string) (OAuthClientRegistration, bool)
- func (s *OAuthStore) Create(_ context.Context, info gooauth2.TokenInfo) error
- func (s *OAuthStore) GetByAccess(ctx context.Context, raw string) (gooauth2.TokenInfo, error)
- func (s *OAuthStore) GetByCode(ctx context.Context, raw string) (gooauth2.TokenInfo, error)
- func (s *OAuthStore) GetByRefresh(ctx context.Context, raw string) (gooauth2.TokenInfo, error)
- func (s *OAuthStore) PruneExpiredClients(now time.Time) (int, error)
- func (s *OAuthStore) RegisterClient(clientName string, redirectURIs, grantTypes []string) (string, error)
- func (s *OAuthStore) RemoveByAccess(_ context.Context, raw string) error
- func (s *OAuthStore) RemoveByCode(_ context.Context, raw string) error
- func (s *OAuthStore) RemoveByRefresh(_ context.Context, raw string) error
- func (s *OAuthStore) RevokeGrant(grantID string, ttl time.Duration) error
- func (s *OAuthStore) ValidateClientID(clientID string) bool
- func (s *OAuthStore) ValidateClientRedirect(clientID, redirectURI string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfiguredLoginValue ¶
func ConfiguredLoginValue() string
func ConstantTimeEqual ¶
func EquivalentResourceURI ¶
func NewOAuthManager ¶ added in v0.6.0
func NewOAuthManager( store *OAuthStore, signingKey string, accessTTLSeconds int64, refreshTTL time.Duration, ) *manage.Manager
NewOAuthManager 使用 go-oauth2 自带的 Manager 承担授权码签发、PKCE 校验、 Access Token 签发、Refresh Token 轮换和 TokenStore 生命周期。AgentDock 只保留 动态客户端注册、MCP resource 约束以及持久化安全策略。
func ParseBearerToken ¶
func RandomToken ¶
func ValidPKCEChallenge ¶
func VerifyPKCE ¶
Types ¶
type OAuthClientRegistration ¶
type OAuthGrant ¶
type OAuthGrant struct {
ClientID string `json:"client_id"`
Resource string `json:"resource"`
AccessTokenHash string `json:"access_token_hash,omitempty"`
AccessIssuedAt int64 `json:"access_issued_at,omitempty"`
AccessExpiresAt int64 `json:"access_expires_at,omitempty"`
AccessNeverExpires bool `json:"access_never_expires,omitempty"`
RefreshIssuedAt int64 `json:"refresh_issued_at,omitempty"`
CurrentGeneration uint64 `json:"current_generation"`
ExpiresAt int64 `json:"expires_at"`
Revoked bool `json:"revoked,omitempty"`
}
type OAuthStore ¶
type OAuthStore struct {
// contains filtered or unexported fields
}
func NewOAuthStore ¶
func NewOAuthStore() *OAuthStore
func NewPersistentOAuthStore ¶
func NewPersistentOAuthStore(path, signingKey string) (*OAuthStore, error)
func (*OAuthStore) ClientAllowsGrant ¶
func (s *OAuthStore) ClientAllowsGrant(clientID, grantType string) bool
func (*OAuthStore) ClientRegistration ¶
func (s *OAuthStore) ClientRegistration(clientID string) (OAuthClientRegistration, bool)
func (*OAuthStore) Create ¶
Create 实现 go-oauth2 TokenStore。授权码保留在短期内存中;Access Token 只持久化 SHA-256,Refresh Token 只持久化代际,状态文件不保存原始令牌。
func (*OAuthStore) GetByAccess ¶ added in v0.6.0
func (*OAuthStore) GetByRefresh ¶ added in v0.6.0
func (*OAuthStore) PruneExpiredClients ¶
func (s *OAuthStore) PruneExpiredClients(now time.Time) (int, error)
func (*OAuthStore) RegisterClient ¶
func (s *OAuthStore) RegisterClient(clientName string, redirectURIs, grantTypes []string) (string, error)
func (*OAuthStore) RemoveByAccess ¶ added in v0.6.0
func (s *OAuthStore) RemoveByAccess(_ context.Context, raw string) error
func (*OAuthStore) RemoveByCode ¶ added in v0.6.0
func (s *OAuthStore) RemoveByCode(_ context.Context, raw string) error
func (*OAuthStore) RemoveByRefresh ¶ added in v0.6.0
func (s *OAuthStore) RemoveByRefresh(_ context.Context, raw string) error
func (*OAuthStore) RevokeGrant ¶
func (s *OAuthStore) RevokeGrant(grantID string, ttl time.Duration) error
func (*OAuthStore) ValidateClientID ¶
func (s *OAuthStore) ValidateClientID(clientID string) bool
func (*OAuthStore) ValidateClientRedirect ¶
func (s *OAuthStore) ValidateClientRedirect(clientID, redirectURI string) bool
Click to show internal directories.
Click to hide internal directories.