Documentation
¶
Overview ¶
Package oidc provides OpenID Connect integration for the auth module. It includes functionality for validating OIDC tokens and extracting user information.
Index ¶
- type Config
- type RetryConfig
- type Service
- func (s *Service) Exchange(ctx context.Context, code string) (*oauth2.Token, error)
- func (s *Service) GetAuthURL(state string) string
- func (s *Service) GetUserInfo(ctx context.Context, token *oauth2.Token) (*oidc.UserInfo, error)
- func (s *Service) IsAdmin(roles []string) bool
- func (s *Service) ValidateToken(ctx context.Context, tokenString string) (*jwt.Claims, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// IssuerURL is the URL of the OIDC provider
IssuerURL string
// ClientID is the client ID for the OIDC provider
ClientID string
// ClientSecret is the client secret for the OIDC provider
ClientSecret string
// RedirectURL is the redirect URL for the OIDC provider
RedirectURL string
// Scopes are the OAuth2 scopes to request
Scopes []string
// AdminRoleName is the name of the admin role
AdminRoleName string
// Timeout is the timeout for OIDC operations
Timeout time.Duration
// RetryConfig is the configuration for retry operations
RetryConfig RetryConfig
}
Config holds the configuration for OIDC integration.
func DefaultConfig ¶ added in v1.5.0
func DefaultConfig() Config
DefaultConfig returns a default configuration for OIDC integration.
type RetryConfig ¶ added in v1.2.0
type RetryConfig struct {
// MaxRetries is the maximum number of retry attempts
MaxRetries int
// InitialBackoff is the initial backoff duration
InitialBackoff time.Duration
// MaxBackoff is the maximum backoff duration
MaxBackoff time.Duration
// BackoffFactor is the factor by which the backoff increases
BackoffFactor float64
}
RetryConfig holds configuration for retry operations.
func DefaultRetryConfig ¶ added in v1.2.0
func DefaultRetryConfig() RetryConfig
DefaultRetryConfig returns the default retry configuration.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles OIDC operations.
func NewService ¶
NewService creates a new OIDC service with the provided configuration and logger.
func (*Service) GetAuthURL ¶
GetAuthURL returns the URL for the OAuth2 authorization endpoint.
func (*Service) GetUserInfo ¶
GetUserInfo gets the user info from the OIDC provider.
Click to show internal directories.
Click to hide internal directories.