Documentation
¶
Index ¶
- Variables
- func ContextWithForwarded(ctx context.Context, internalURL *url.URL, externalURL *url.URL) context.Context
- func NewConfig(confUnmarshal ConfigurationProvider) (keycloak.Config, error)
- func NewKeycloakURIProvider(entries map[string]string, defaultKey string) (keycloak.KeycloakURIProvider, error)
- func NewKeycloakURIProviderFromArray(uris []string) (keycloak.KeycloakURIProvider, error)
- type ComponentConfig
- type ComponentConfigKeyValue
- type ComponentTool
- type ConfigurationProvider
- type GenericComponentTool
- func (ct *GenericComponentTool) DeleteComponentEntry(comp *keycloak.ComponentRepresentation, key string) (bool, error)
- func (ct *GenericComponentTool) FindComponent(components []keycloak.ComponentRepresentation) *keycloak.ComponentRepresentation
- func (ct *GenericComponentTool) GetComponentEntry(comp *keycloak.ComponentRepresentation, key string, out any) error
- func (ct *GenericComponentTool) GetProviderType() string
- func (ct *GenericComponentTool) InitializeComponent(parentID string, idpID string, initial any) (keycloak.ComponentRepresentation, error)
- func (ct *GenericComponentTool) UpdateComponentEntry(comp *keycloak.ComponentRepresentation, key string, value any) error
- type InternalConfig
- type IssuerManager
- type Logger
- type OAuth2Config
- type OidcTokenProvider
- type OidcVerifier
- type OidcVerifierProvider
- type ProfileRetriever
- type UserProfileCache
Constants ¶
This section is empty.
Variables ¶
var ( ErrConfigKeyNotFound = errors.New("component config key not found") ErrInvalidConfigFormat = errors.New("invalid config encoding") )
Errors definition
Functions ¶
func ContextWithForwarded ¶ added in v2.16.0
func ContextWithForwarded(ctx context.Context, internalURL *url.URL, externalURL *url.URL) context.Context
ContextWithForwarded returns a context that allows http client to use a Forwarded header
func NewConfig ¶ added in v2.11.0
func NewConfig(confUnmarshal ConfigurationProvider) (keycloak.Config, error)
NewConfig returns a Keycloak configuration
func NewKeycloakURIProvider ¶
func NewKeycloakURIProvider(entries map[string]string, defaultKey string) (keycloak.KeycloakURIProvider, error)
NewKeycloakURIProvider creates a Keycloak URI provider
func NewKeycloakURIProviderFromArray ¶
func NewKeycloakURIProviderFromArray(uris []string) (keycloak.KeycloakURIProvider, error)
NewKeycloakURIProviderFromArray creates a Keycloak URI provider
Types ¶
type ComponentConfig ¶ added in v2.14.0
type ComponentConfig struct {
ProviderType string `mapstructure:"provider-type"`
ProviderID string `mapstructure:"provider-id"`
ConfigName string `mapstructure:"config-name"`
}
ComponentConfig struct
type ComponentConfigKeyValue ¶ added in v2.14.0
ComponentConfigKeyValue struct
type ComponentTool ¶ added in v2.14.0
type ComponentTool interface {
FindComponent(components []keycloak.ComponentRepresentation) *keycloak.ComponentRepresentation
InitializeComponent(realmName string, idpID string, initial any) (keycloak.ComponentRepresentation, error)
GetComponentEntry(comp *keycloak.ComponentRepresentation, key string, out any) error
UpdateComponentEntry(comp *keycloak.ComponentRepresentation, key string, value any) error
DeleteComponentEntry(comp *keycloak.ComponentRepresentation, key string) (bool, error)
GetProviderType() string
}
ComponentTool interface
func NewComponentTool ¶ added in v2.14.0
func NewComponentTool(config ComponentConfig) ComponentTool
NewComponentTool creates
type ConfigurationProvider ¶ added in v2.11.0
ConfigurationProvider interface
type GenericComponentTool ¶ added in v2.14.0
GenericComponentTool struct
func (*GenericComponentTool) DeleteComponentEntry ¶ added in v2.14.0
func (ct *GenericComponentTool) DeleteComponentEntry(comp *keycloak.ComponentRepresentation, key string) (bool, error)
DeleteComponentEntry deletes a component entry
func (*GenericComponentTool) FindComponent ¶ added in v2.14.0
func (ct *GenericComponentTool) FindComponent(components []keycloak.ComponentRepresentation) *keycloak.ComponentRepresentation
FindComponent searches a component
func (*GenericComponentTool) GetComponentEntry ¶ added in v2.14.0
func (ct *GenericComponentTool) GetComponentEntry(comp *keycloak.ComponentRepresentation, key string, out any) error
GetComponentEntry decodes a stored JSON value into the provided struct.
func (*GenericComponentTool) GetProviderType ¶ added in v2.14.0
func (ct *GenericComponentTool) GetProviderType() string
GetProviderType returns the provider type
func (*GenericComponentTool) InitializeComponent ¶ added in v2.14.0
func (ct *GenericComponentTool) InitializeComponent(parentID string, idpID string, initial any) (keycloak.ComponentRepresentation, error)
InitializeComponent initializes a component
func (*GenericComponentTool) UpdateComponentEntry ¶ added in v2.14.0
func (ct *GenericComponentTool) UpdateComponentEntry(comp *keycloak.ComponentRepresentation, key string, value any) error
UpdateComponentEntry encodes a struct and stores it under the key.
type InternalConfig ¶ added in v2.11.0
type InternalConfig struct {
InternalURI string `mapstructure:"internal-uri"`
RealmPublicURI map[string]string `mapstructure:"realm-public-uri-map"`
DefaultKey *string `mapstructure:"default-key"`
Timeout time.Duration `mapstructure:"timeout"`
}
InternalConfig struct
type IssuerManager ¶
type IssuerManager interface {
GetOidcVerifierProvider(issuer string) (OidcVerifierProvider, error)
}
IssuerManager provides URL according to a given context
func NewIssuerManager ¶
func NewIssuerManager(config keycloak.Config) (IssuerManager, error)
NewIssuerManager creates a new URLProvider
type OAuth2Config ¶ added in v2.7.0
type OAuth2Config struct {
Realm *string `mapstructure:"realm"`
Username *string `mapstructure:"username"`
Password *string `mapstructure:"password"`
ClientID *string `mapstructure:"client-id"`
ClientSecret *string `mapstructure:"client-secret"`
}
OAuth2Config struct
func (*OAuth2Config) IsClientConfig ¶ added in v2.7.0
func (oac *OAuth2Config) IsClientConfig() bool
IsClientConfig checks if the config is a client config or a username/password one
type OidcTokenProvider ¶
type OidcTokenProvider interface {
ProvideToken(ctx context.Context) (string, error)
ProvideTokenForRealm(ctx context.Context, realm string) (string, error)
}
OidcTokenProvider provides OIDC tokens
func NewOAuth2TokenProvider ¶ added in v2.7.0
func NewOAuth2TokenProvider(kcConfig keycloak.Config, oauth2Config OAuth2Config, logger Logger) OidcTokenProvider
NewOAuth2TokenProvider creates an OidcTokenProvider
func NewOidcTokenProvider ¶
func NewOidcTokenProvider(config keycloak.Config, realm, username, password, clientID string, logger Logger) OidcTokenProvider
NewOidcTokenProvider creates an OidcTokenProvider
type OidcVerifier ¶
OidcVerifier is an interface for OIDC token verifiers
type OidcVerifierProvider ¶
type OidcVerifierProvider interface {
GetOidcVerifier(realm string) (OidcVerifier, error)
}
OidcVerifierProvider is an interface for a provider of OidcVerifier instances
func NewVerifierCache ¶
func NewVerifierCache(internalURL *url.URL, externalURL *url.URL) OidcVerifierProvider
NewVerifierCache create an instance of OIDC verifier cache
type ProfileRetriever ¶ added in v2.6.1
type ProfileRetriever interface {
GetRealm(accessToken string, realmName string) (keycloak.RealmRepresentation, error)
GetUserProfile(accessToken string, realmName string) (keycloak.UserProfileRepresentation, error)
}
ProfileRetriever interface
type UserProfileCache ¶ added in v2.6.1
type UserProfileCache struct {
// contains filtered or unexported fields
}
UserProfileCache struct
func NewUserProfileCache ¶ added in v2.6.1
func NewUserProfileCache(retriever ProfileRetriever, tokenProvider OidcTokenProvider) *UserProfileCache
NewUserProfileCache creates a UserProfileCache instance
func (*UserProfileCache) GetRealmUserProfile ¶ added in v2.6.1
func (upc *UserProfileCache) GetRealmUserProfile(ctx context.Context, realmName string) (keycloak.UserProfileRepresentation, error)
GetRealmUserProfile gets the realm users profile using the token provider provided when creating the UserProfileCache instance
func (*UserProfileCache) GetRealmUserProfileWithToken ¶ added in v2.6.1
func (upc *UserProfileCache) GetRealmUserProfileWithToken(accessToken string, realmName string) (keycloak.UserProfileRepresentation, error)
GetRealmUserProfileWithToken gets the realm users profile using the provided access token