mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-14 04:07:46 +00:00
Release 0.7.5 (#70)
* Resolve issue with opaque tokens not being parsed correctly * Increase test coverage * Further improvements to test coverage and code quality * Add new providers. * fixup! Add new providers. * Cleanup. * fixup! Cleanup. * fixup! fixup! Cleanup. * fixup! fixup! fixup! Cleanup. * fixup! fixup! fixup! fixup! Cleanup. * Memory management optimisation 24 bytes per Put < 256-4096 bytes per buffer allocation avoided (10-170x difference) * Pooling cleanup.
This commit is contained in:
@@ -18,6 +18,12 @@ func NewProviderFactory() *ProviderFactory {
|
||||
registry.RegisterProvider(NewGenericProvider())
|
||||
registry.RegisterProvider(NewGoogleProvider())
|
||||
registry.RegisterProvider(NewAzureProvider())
|
||||
registry.RegisterProvider(NewGitHubProvider())
|
||||
registry.RegisterProvider(NewAuth0Provider())
|
||||
registry.RegisterProvider(NewOktaProvider())
|
||||
registry.RegisterProvider(NewKeycloakProvider())
|
||||
registry.RegisterProvider(NewAWSCognitoProvider())
|
||||
registry.RegisterProvider(NewGitLabProvider())
|
||||
|
||||
return &ProviderFactory{
|
||||
registry: registry,
|
||||
@@ -31,10 +37,16 @@ func (f *ProviderFactory) CreateProvider(issuerURL string) (OIDCProvider, error)
|
||||
return nil, fmt.Errorf("issuer URL cannot be empty")
|
||||
}
|
||||
|
||||
if _, err := url.Parse(issuerURL); err != nil {
|
||||
parsedURL, err := url.Parse(issuerURL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid issuer URL format: %w", err)
|
||||
}
|
||||
|
||||
// Check if the URL has a valid scheme and host
|
||||
if parsedURL.Scheme == "" || parsedURL.Host == "" {
|
||||
return nil, fmt.Errorf("invalid issuer URL format: URL must have a valid scheme and host")
|
||||
}
|
||||
|
||||
provider := f.registry.DetectProvider(issuerURL)
|
||||
if provider == nil {
|
||||
return nil, fmt.Errorf("unable to detect provider for issuer URL: %s", issuerURL)
|
||||
@@ -59,6 +71,18 @@ func (f *ProviderFactory) CreateProviderByType(providerType ProviderType) (OIDCP
|
||||
provider = NewGoogleProvider()
|
||||
case ProviderTypeAzure:
|
||||
provider = NewAzureProvider()
|
||||
case ProviderTypeGitHub:
|
||||
provider = NewGitHubProvider()
|
||||
case ProviderTypeAuth0:
|
||||
provider = NewAuth0Provider()
|
||||
case ProviderTypeOkta:
|
||||
provider = NewOktaProvider()
|
||||
case ProviderTypeKeycloak:
|
||||
provider = NewKeycloakProvider()
|
||||
case ProviderTypeAWSCognito:
|
||||
provider = NewAWSCognitoProvider()
|
||||
case ProviderTypeGitLab:
|
||||
provider = NewGitLabProvider()
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported provider type: %d", providerType)
|
||||
}
|
||||
@@ -73,9 +97,15 @@ func (f *ProviderFactory) CreateProviderByType(providerType ProviderType) (OIDCP
|
||||
// GetSupportedProviders returns a list of all supported provider types and their detection patterns.
|
||||
func (f *ProviderFactory) GetSupportedProviders() map[ProviderType][]string {
|
||||
return map[ProviderType][]string{
|
||||
ProviderTypeGeneric: {"*"},
|
||||
ProviderTypeGoogle: {"accounts.google.com"},
|
||||
ProviderTypeAzure: {"login.microsoftonline.com", "sts.windows.net"},
|
||||
ProviderTypeGeneric: {"*"},
|
||||
ProviderTypeGoogle: {"accounts.google.com"},
|
||||
ProviderTypeAzure: {"login.microsoftonline.com", "sts.windows.net"},
|
||||
ProviderTypeGitHub: {"github.com"},
|
||||
ProviderTypeAuth0: {".auth0.com"},
|
||||
ProviderTypeOkta: {".okta.com", ".oktapreview.com", ".okta-emea.com"},
|
||||
ProviderTypeKeycloak: {"keycloak"},
|
||||
ProviderTypeAWSCognito: {"cognito-idp", ".amazonaws.com"},
|
||||
ProviderTypeGitLab: {"gitlab.com"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +130,11 @@ func (f *ProviderFactory) IsProviderSupported(issuerURL string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if the URL has a valid scheme and host
|
||||
if normalizedURL.Scheme == "" || normalizedURL.Host == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
host := strings.ToLower(normalizedURL.Host)
|
||||
supportedProviders := f.GetSupportedProviders()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user