Documentation
¶
Index ¶
- Variables
- func GetDialector(driver, dsn string) (gorm.Dialector, error)
- func RegisterDriver(name string, factory DriverFactory)
- type DriverFactory
- type Store
- func (s *Store) CreateAccessToken(token *models.AccessToken) error
- func (s *Store) CreateClient(client *models.OAuthClient) error
- func (s *Store) CreateDeviceCode(dc *models.DeviceCode) error
- func (s *Store) CreateOAuthConnection(conn *models.OAuthConnection) error
- func (s *Store) CreateUser(user *models.User) error
- func (s *Store) DB() *gorm.DB
- func (s *Store) DeleteClient(clientID string) error
- func (s *Store) DeleteDeviceCode(deviceCode string) error
- func (s *Store) DeleteExpiredDeviceCodes() error
- func (s *Store) DeleteExpiredTokens() error
- func (s *Store) DeleteOAuthConnection(id string) error
- func (s *Store) DeleteUser(id string) error
- func (s *Store) GetAccessToken(token string) (*models.AccessToken, error)
- func (s *Store) GetAccessTokenByID(tokenID string) (*models.AccessToken, error)
- func (s *Store) GetClient(clientID string) (*models.OAuthClient, error)
- func (s *Store) GetClientsByIDs(clientIDs []string) (map[string]*models.OAuthClient, error)
- func (s *Store) GetDeviceCode(deviceCode string) (*models.DeviceCode, error)
- func (s *Store) GetDeviceCodeByUserCode(userCode string) (*models.DeviceCode, error)
- func (s *Store) GetOAuthConnection(provider, providerUserID string) (*models.OAuthConnection, error)
- func (s *Store) GetOAuthConnectionByUserAndProvider(userID, provider string) (*models.OAuthConnection, error)
- func (s *Store) GetOAuthConnectionsByUserID(userID string) ([]models.OAuthConnection, error)
- func (s *Store) GetTokensByCategoryAndStatus(userID, category, status string) ([]models.AccessToken, error)
- func (s *Store) GetTokensByUserID(userID string) ([]models.AccessToken, error)
- func (s *Store) GetUserByEmail(email string) (*models.User, error)
- func (s *Store) GetUserByExternalID(externalID, authSource string) (*models.User, error)
- func (s *Store) GetUserByID(id string) (*models.User, error)
- func (s *Store) GetUserByUsername(username string) (*models.User, error)
- func (s *Store) Health() error
- func (s *Store) ListClients() ([]models.OAuthClient, error)
- func (s *Store) RevokeToken(tokenID string) error
- func (s *Store) RevokeTokensByClientID(clientID string) error
- func (s *Store) RevokeTokensByUserID(userID string) error
- func (s *Store) UpdateClient(client *models.OAuthClient) error
- func (s *Store) UpdateDeviceCode(dc *models.DeviceCode) error
- func (s *Store) UpdateOAuthConnection(conn *models.OAuthConnection) error
- func (s *Store) UpdateTokenStatus(tokenID, status string) error
- func (s *Store) UpdateUser(user *models.User) error
- func (s *Store) UpsertExternalUser(username, externalID, authSource, email, fullName string) (*models.User, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUsernameConflict is returned when a username already exists ErrUsernameConflict = errors.New("username already exists") // ErrRecordNotFound wraps GORM's not found error for consistency ErrRecordNotFound = errors.New("record not found") )
Functions ¶
func GetDialector ¶ added in v0.3.0
GetDialector returns a GORM dialector for the given driver name and DSN
func RegisterDriver ¶ added in v0.3.0
func RegisterDriver(name string, factory DriverFactory)
RegisterDriver allows registering custom database drivers
Types ¶
type DriverFactory ¶ added in v0.3.0
DriverFactory is a function that creates a gorm.Dialector
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateAccessToken ¶
func (s *Store) CreateAccessToken(token *models.AccessToken) error
Access Token operations
func (*Store) CreateClient ¶ added in v0.2.0
func (s *Store) CreateClient(client *models.OAuthClient) error
func (*Store) CreateDeviceCode ¶
func (s *Store) CreateDeviceCode(dc *models.DeviceCode) error
Device Code operations
func (*Store) CreateOAuthConnection ¶ added in v0.6.0
func (s *Store) CreateOAuthConnection(conn *models.OAuthConnection) error
CreateOAuthConnection creates a new OAuth connection
func (*Store) CreateUser ¶ added in v0.6.0
CreateUser creates a new user
func (*Store) DB ¶ added in v0.3.0
DB returns the underlying GORM database connection (for transactions)
func (*Store) DeleteClient ¶ added in v0.2.0
func (*Store) DeleteDeviceCode ¶
func (*Store) DeleteExpiredDeviceCodes ¶
func (*Store) DeleteExpiredTokens ¶
func (*Store) DeleteOAuthConnection ¶ added in v0.6.0
DeleteOAuthConnection deletes an OAuth connection by ID
func (*Store) DeleteUser ¶ added in v0.6.0
DeleteUser deletes a user by ID
func (*Store) GetAccessToken ¶
func (s *Store) GetAccessToken(token string) (*models.AccessToken, error)
func (*Store) GetAccessTokenByID ¶ added in v0.2.0
func (s *Store) GetAccessTokenByID(tokenID string) (*models.AccessToken, error)
func (*Store) GetClient ¶
func (s *Store) GetClient(clientID string) (*models.OAuthClient, error)
OAuth Client operations
func (*Store) GetClientsByIDs ¶ added in v0.2.0
func (*Store) GetDeviceCode ¶
func (s *Store) GetDeviceCode(deviceCode string) (*models.DeviceCode, error)
func (*Store) GetDeviceCodeByUserCode ¶
func (s *Store) GetDeviceCodeByUserCode(userCode string) (*models.DeviceCode, error)
func (*Store) GetOAuthConnection ¶ added in v0.6.0
func (s *Store) GetOAuthConnection( provider, providerUserID string, ) (*models.OAuthConnection, error)
GetOAuthConnection finds an OAuth connection by provider and provider user ID
func (*Store) GetOAuthConnectionByUserAndProvider ¶ added in v0.6.0
func (s *Store) GetOAuthConnectionByUserAndProvider( userID, provider string, ) (*models.OAuthConnection, error)
GetOAuthConnectionByUserAndProvider finds an OAuth connection by user ID and provider
func (*Store) GetOAuthConnectionsByUserID ¶ added in v0.6.0
func (s *Store) GetOAuthConnectionsByUserID(userID string) ([]models.OAuthConnection, error)
GetOAuthConnectionsByUserID returns all OAuth connections for a user
func (*Store) GetTokensByCategoryAndStatus ¶ added in v0.3.0
func (s *Store) GetTokensByCategoryAndStatus( userID, category, status string, ) ([]models.AccessToken, error)
GetTokensByCategoryAndStatus returns tokens filtered by category and status
func (*Store) GetTokensByUserID ¶ added in v0.2.0
func (s *Store) GetTokensByUserID(userID string) ([]models.AccessToken, error)
func (*Store) GetUserByEmail ¶ added in v0.6.0
GetUserByEmail finds a user by email address
func (*Store) GetUserByExternalID ¶ added in v0.3.0
GetUserByExternalID finds a user by their external ID and auth source
func (*Store) GetUserByUsername ¶
User operations
func (*Store) ListClients ¶ added in v0.2.0
func (s *Store) ListClients() ([]models.OAuthClient, error)
func (*Store) RevokeToken ¶ added in v0.2.0
func (*Store) RevokeTokensByClientID ¶ added in v0.2.0
func (*Store) RevokeTokensByUserID ¶ added in v0.2.0
func (*Store) UpdateClient ¶ added in v0.2.0
func (s *Store) UpdateClient(client *models.OAuthClient) error
func (*Store) UpdateDeviceCode ¶
func (s *Store) UpdateDeviceCode(dc *models.DeviceCode) error
func (*Store) UpdateOAuthConnection ¶ added in v0.6.0
func (s *Store) UpdateOAuthConnection(conn *models.OAuthConnection) error
UpdateOAuthConnection updates an existing OAuth connection
func (*Store) UpdateTokenStatus ¶ added in v0.3.0
UpdateTokenStatus updates the status of a token
func (*Store) UpdateUser ¶ added in v0.6.0
UpdateUser updates an existing user