Documentation
¶
Index ¶
- type AuthorizedCode
- type IssuedToken
- type MockOAuthServer
- func (m *MockOAuthServer) Close()
- func (m *MockOAuthServer) CreateMockProvider() oauth.Provider
- func (m *MockOAuthServer) GetAuthURL() string
- func (m *MockOAuthServer) GetRevokeURL() string
- func (m *MockOAuthServer) GetTokenURL() string
- func (m *MockOAuthServer) GetURL() string
- func (m *MockOAuthServer) GetUserInfoURL() string
- func (m *MockOAuthServer) IssueAuthorizationCode(userID, state, redirectURI string, pkceVerifier string) string
- func (m *MockOAuthServer) SetErrorRate(endpoint string, rate float64)
- func (m *MockOAuthServer) SetFailureScenario(scenario string, enabled bool)
- func (m *MockOAuthServer) SetLatency(endpoint string, latency time.Duration)
- func (m *MockOAuthServer) SetUserInfo(userID string, info *oauth.UserInfo)
- type MockProvider
- func (p *MockProvider) Exchange(ctx context.Context, code string, pkce *oauth.PKCEChallenge) (*oauth.Token, error)
- func (p *MockProvider) GetAuthURL(state string, pkce *oauth.PKCEChallenge) string
- func (p *MockProvider) GetUserInfo(ctx context.Context, accessToken string) (*oauth.UserInfo, error)
- func (p *MockProvider) Name() string
- func (p *MockProvider) RefreshToken(ctx context.Context, refreshToken string) (*oauth.Token, error)
- func (p *MockProvider) RevokeToken(ctx context.Context, token string) error
- func (p *MockProvider) SupportsPKCE() bool
- func (p *MockProvider) SupportsRefresh() bool
- func (p *MockProvider) ValidateConfig() error
- type MockServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizedCode ¶
type AuthorizedCode struct {
Code string
ClientID string
RedirectURI string
State string
PKCEVerifier string
UserID string
Scopes []string
IssuedAt time.Time
ExpiresAt time.Time
}
AuthorizedCode represents an authorized code
type IssuedToken ¶
type IssuedToken struct {
AccessToken string
RefreshToken string
TokenType string
ExpiresAt time.Time
UserID string
Scopes []string
IssuedAt time.Time
}
IssuedToken represents an issued token
type MockOAuthServer ¶
type MockOAuthServer struct {
// contains filtered or unexported fields
}
MockOAuthServer simulates an OAuth 2.0 provider for testing
func NewMockOAuthServer ¶
func NewMockOAuthServer(config MockServerConfig) *MockOAuthServer
NewMockOAuthServer creates a new mock OAuth server
func (*MockOAuthServer) CreateMockProvider ¶
func (m *MockOAuthServer) CreateMockProvider() oauth.Provider
CreateMockProvider creates an OAuth provider configured for the mock server
func (*MockOAuthServer) GetAuthURL ¶
func (m *MockOAuthServer) GetAuthURL() string
GetAuthURL returns the authorization endpoint URL
func (*MockOAuthServer) GetRevokeURL ¶
func (m *MockOAuthServer) GetRevokeURL() string
GetRevokeURL returns the revoke endpoint URL
func (*MockOAuthServer) GetTokenURL ¶
func (m *MockOAuthServer) GetTokenURL() string
GetTokenURL returns the token endpoint URL
func (*MockOAuthServer) GetURL ¶
func (m *MockOAuthServer) GetURL() string
GetURL returns the mock server URL
func (*MockOAuthServer) GetUserInfoURL ¶
func (m *MockOAuthServer) GetUserInfoURL() string
GetUserInfoURL returns the user info endpoint URL
func (*MockOAuthServer) IssueAuthorizationCode ¶
func (m *MockOAuthServer) IssueAuthorizationCode(userID, state, redirectURI string, pkceVerifier string) string
IssueAuthorizationCode issues a new authorization code
func (*MockOAuthServer) SetErrorRate ¶
func (m *MockOAuthServer) SetErrorRate(endpoint string, rate float64)
SetErrorRate sets the error rate for an endpoint (0.0 to 1.0)
func (*MockOAuthServer) SetFailureScenario ¶
func (m *MockOAuthServer) SetFailureScenario(scenario string, enabled bool)
SetFailureScenario enables a specific failure scenario
func (*MockOAuthServer) SetLatency ¶
func (m *MockOAuthServer) SetLatency(endpoint string, latency time.Duration)
SetLatency sets artificial latency for an endpoint
func (*MockOAuthServer) SetUserInfo ¶
func (m *MockOAuthServer) SetUserInfo(userID string, info *oauth.UserInfo)
SetUserInfo sets user information for a specific user ID
type MockProvider ¶
type MockProvider struct {
// contains filtered or unexported fields
}
MockProvider implements oauth.Provider for testing
func (*MockProvider) Exchange ¶
func (p *MockProvider) Exchange(ctx context.Context, code string, pkce *oauth.PKCEChallenge) (*oauth.Token, error)
func (*MockProvider) GetAuthURL ¶
func (p *MockProvider) GetAuthURL(state string, pkce *oauth.PKCEChallenge) string
func (*MockProvider) GetUserInfo ¶
func (*MockProvider) Name ¶
func (p *MockProvider) Name() string
func (*MockProvider) RefreshToken ¶
func (*MockProvider) RevokeToken ¶
func (p *MockProvider) RevokeToken(ctx context.Context, token string) error
func (*MockProvider) SupportsPKCE ¶
func (p *MockProvider) SupportsPKCE() bool
func (*MockProvider) SupportsRefresh ¶
func (p *MockProvider) SupportsRefresh() bool
func (*MockProvider) ValidateConfig ¶
func (p *MockProvider) ValidateConfig() error