toolbox

package
v2.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportLegacyAddrTokenProvider

func ImportLegacyAddrTokenProvider(c *keycloak.Config) error

ImportLegacyAddrTokenProvider

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 DefaultProfileProviderFunc added in v2.6.1

type DefaultProfileProviderFunc func(realmName string) (keycloak.UserProfileRepresentation, error)

DefaultProfileProviderFunc function type

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 Logger

type Logger interface {
	Warn(ctx context.Context, keyvals ...interface{})
}

Logger interface for logging with level

type OidcTokenProvider

type OidcTokenProvider interface {
	ProvideToken(ctx context.Context) (string, error)
	ProvideTokenForRealm(ctx context.Context, realm string) (string, error)
}

OidcTokenProvider provides OIDC tokens

func NewOidcTokenProvider

func NewOidcTokenProvider(config keycloak.Config, realm, username, password, clientID string, logger Logger) OidcTokenProvider

NewOidcTokenProvider creates an OidcTokenProvider

type OidcVerifier

type OidcVerifier interface {
	Verify(accessToken string) error
}

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(tokenURL *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, defProfileProvider DefaultProfileProviderFunc) *UserProfileCache

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL