Documentation
¶
Index ¶
Constants ¶
View Source
const JWTSigningKeyID = "jwt_signing_key"
Variables ¶
View Source
var ( ErrNotFound = errors.New("key not found") ErrDB = errors.New("database error") )
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
Roles []string `json:"roles"`
Permissions []string `json:"permissions"`
Preferences map[string]interface{} `json:"preferences,omitempty"`
jwt.RegisteredClaims
}
type OAuthManager ¶
type OAuthManager struct {
// contains filtered or unexported fields
}
func NewOAuthManager ¶
func NewOAuthManager() *OAuthManager
func (*OAuthManager) GetProvider ¶
func (m *OAuthManager) GetProvider(providerType string) (OAuthProvider, bool)
func (*OAuthManager) RegisterProvider ¶
func (m *OAuthManager) RegisterProvider(provider OAuthProvider)
type OAuthProvider ¶
type OktaProvider ¶
type OktaProvider struct {
// contains filtered or unexported fields
}
OktaProvider represents the OAuth provider for Okta.
func NewOktaProvider ¶
func NewOktaProvider(cfg *config.Config, userService user.Service, authService Service, teamService *team.Service) *OktaProvider
NewOktaProvider creates a new OktaProvider.
func (*OktaProvider) GetAuthURL ¶
func (p *OktaProvider) GetAuthURL(state string) string
func (*OktaProvider) HandleCallback ¶
func (*OktaProvider) Name ¶
func (p *OktaProvider) Name() string
Name returns the name of the provider.
func (*OktaProvider) Type ¶
func (p *OktaProvider) Type() string
Type returns the type of the provider.
type Repository ¶
type Repository interface {
GetSigningKey(ctx context.Context, key string) (string, error)
StoreSigningKey(ctx context.Context, key, value string) error
}
func NewPostgresRepository ¶
func NewPostgresRepository(db *pgxpool.Pool) Repository
type Service ¶
type Service interface {
GenerateToken(ctx context.Context, user *user.User, preferencesClaims map[string]interface{}) (string, error)
ValidateToken(ctx context.Context, tokenString string) (*Claims, error)
GetSigningKey(ctx context.Context) ([]byte, error)
}
func NewService ¶
func NewService(repo Repository, userService user.Service) Service
Click to show internal directories.
Click to hide internal directories.