Documentation
¶
Index ¶
- type Adapter
- type OAuthTokenProvider
- type StaticTokenProvider
- func (p *StaticTokenProvider) AuthMethod() domain.AuthMethod
- func (p *StaticTokenProvider) GetAccessToken(ctx context.Context) (string, error)
- func (p *StaticTokenProvider) GetCredentials(ctx context.Context) (*domain.Credentials, error)
- func (p *StaticTokenProvider) IsValid(ctx context.Context) bool
- type TokenProviderFactory
- func (f *TokenProviderFactory) Create(ctx context.Context, connectionID string) (driven.TokenProvider, error)
- func (f *TokenProviderFactory) CreateFromConnection(ctx context.Context, conn *domain.Connection) (driven.TokenProvider, error)
- func (f *TokenProviderFactory) RegisterRefresher(platform domain.PlatformType, refresher TokenRefresherFunc)
- type TokenRefresherFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter handles authentication operations using bcrypt and JWT
func NewAdapter ¶
NewAdapter creates a new auth adapter with the given JWT secret
func NewAdapterWithCost ¶
NewAdapterWithCost creates a new auth adapter with custom bcrypt cost
func (*Adapter) GenerateToken ¶
func (a *Adapter) GenerateToken(claims *domain.TokenClaims) (string, error)
GenerateToken creates a signed JWT from domain claims
func (*Adapter) HashPassword ¶
HashPassword generates a bcrypt hash from a plaintext password
func (*Adapter) ParseToken ¶
func (a *Adapter) ParseToken(tokenString string) (*domain.TokenClaims, error)
ParseToken validates a JWT and extracts domain claims
func (*Adapter) VerifyPassword ¶
VerifyPassword checks if a password matches a bcrypt hash
type OAuthTokenProvider ¶
type OAuthTokenProvider struct {
// contains filtered or unexported fields
}
OAuthTokenProvider implements TokenProvider for OAuth2 credentials. It automatically refreshes tokens when they expire.
func NewOAuthTokenProvider ¶
func NewOAuthTokenProvider( connectionID string, accessToken string, refreshToken string, expiry *time.Time, refresher TokenRefresherFunc, connectionStore driven.ConnectionStore, ) *OAuthTokenProvider
NewOAuthTokenProvider creates a token provider for OAuth credentials.
func (*OAuthTokenProvider) AuthMethod ¶
func (p *OAuthTokenProvider) AuthMethod() domain.AuthMethod
AuthMethod returns OAuth2.
func (*OAuthTokenProvider) GetAccessToken ¶
func (p *OAuthTokenProvider) GetAccessToken(ctx context.Context) (string, error)
GetAccessToken returns a valid access token, refreshing if needed.
func (*OAuthTokenProvider) GetCredentials ¶
func (p *OAuthTokenProvider) GetCredentials(ctx context.Context) (*domain.Credentials, error)
GetCredentials returns credentials for OAuth.
type StaticTokenProvider ¶
type StaticTokenProvider struct {
// contains filtered or unexported fields
}
StaticTokenProvider implements TokenProvider for non-OAuth credentials. Used for API keys, PATs, and service accounts.
func NewStaticTokenProvider ¶
func NewStaticTokenProvider(token string, authMethod domain.AuthMethod) *StaticTokenProvider
NewStaticTokenProvider creates a token provider for static credentials.
func (*StaticTokenProvider) AuthMethod ¶
func (p *StaticTokenProvider) AuthMethod() domain.AuthMethod
AuthMethod returns the authentication method.
func (*StaticTokenProvider) GetAccessToken ¶
func (p *StaticTokenProvider) GetAccessToken(ctx context.Context) (string, error)
GetAccessToken returns the static token.
func (*StaticTokenProvider) GetCredentials ¶
func (p *StaticTokenProvider) GetCredentials(ctx context.Context) (*domain.Credentials, error)
GetCredentials returns nil for static tokens - use GetAccessToken instead.
type TokenProviderFactory ¶
type TokenProviderFactory struct {
// contains filtered or unexported fields
}
TokenProviderFactory creates TokenProviders from connection credentials.
func NewTokenProviderFactory ¶
func NewTokenProviderFactory( connectionStore driven.ConnectionStore, ) *TokenProviderFactory
NewTokenProviderFactory creates a new TokenProviderFactory.
func (*TokenProviderFactory) Create ¶
func (f *TokenProviderFactory) Create(ctx context.Context, connectionID string) (driven.TokenProvider, error)
Create creates a TokenProvider for a connection. It looks up the connection by ID, decrypts credentials, and creates an appropriate TokenProvider based on the auth method.
func (*TokenProviderFactory) CreateFromConnection ¶
func (f *TokenProviderFactory) CreateFromConnection(ctx context.Context, conn *domain.Connection) (driven.TokenProvider, error)
CreateFromConnection creates a TokenProvider from a connection directly. Use this when you already have the connection loaded.
func (*TokenProviderFactory) RegisterRefresher ¶
func (f *TokenProviderFactory) RegisterRefresher( platform domain.PlatformType, refresher TokenRefresherFunc, )
RegisterRefresher registers a token refresh function for a platform type.
type TokenRefresherFunc ¶
TokenRefresherFunc is a function type for token refresh operations.