keycloak

package
v0.0.0-...-8f49458 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGlobalHelper

func NewGlobalHelper(opts ...Option) error

Types

type Auth

type Auth struct {
	Realm    string `json:"realm" yaml:"realm"`
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

type Client

type Client interface {
	RestyClient() *resty.Client
	Login(context.Context, string, string, string, string, string) (*gocloak.JWT, error)
	LoginAdmin(context.Context, string, string, string) (*gocloak.JWT, error)
	GetUsers(context.Context, string, string, gocloak.GetUsersParams) ([]*gocloak.User, error)
	GetClients(context.Context, string, string, gocloak.GetClientsParams) ([]*gocloak.Client, error)
	CreateClient(context.Context, string, string, gocloak.Client) (string, error)
	CreateClientProtocolMapper(context.Context, string, string, string, gocloak.ProtocolMapperRepresentation) (string, error)
	GetClientSecret(ctx context.Context, token, realm, idOfClient string) (*gocloak.CredentialRepresentation, error)
	UpdateUser(context.Context, string, string, gocloak.User) error
	LogoutUserSession(context.Context, string, string, string) error
}

type Helper

type Helper struct {
	Client
	Token string

	Options
}

func GetGlobalHelper

func GetGlobalHelper() *Helper

func NewHelper

func NewHelper(opts ...Option) (*Helper, error)

func (*Helper) CreateClient

func (h *Helper) CreateClient(realm string, opts gocloak.Client) (string, error)

func (*Helper) CreateClientProtocolMapper

func (h *Helper) CreateClientProtocolMapper(realm, clientID string, opts gocloak.ProtocolMapperRepresentation) (string, error)

func (*Helper) GetClientSecret

func (h *Helper) GetClientSecret(realm, clientID string) (*gocloak.CredentialRepresentation, error)

func (*Helper) GetClients

func (h *Helper) GetClients(realm string, params gocloak.GetClientsParams) ([]*gocloak.Client, error)

func (*Helper) LoginAdmin

func (h *Helper) LoginAdmin() error

func (*Helper) LogoutUserSession

func (h *Helper) LogoutUserSession(realm, sessionID string) error

func (*Helper) SetKeycloakClient

func (h *Helper) SetKeycloakClient() error

func (*Helper) UpdateUser

func (h *Helper) UpdateUser(realm string, user gocloak.User) error

type Host

type Host struct {
	Scheme                string `json:"scheme" yaml:"scheme"`
	Ip                    string `json:"ip" yaml:"ip"`
	Port                  int    `json:"port" yaml:"port"`
	Path                  string `json:"path" yaml:"path"`
	TlsInsecureSkipVerify bool   `json:"tlsInsecureSkipVerify" yaml:"tlsInsecureSkipVerify"`
}

type Option

type Option func(*Options)

func Insecure

func Insecure(insecure bool) Option

func Ip

func Ip(ip string) Option

func Password

func Password(password string) Option

func Path

func Path(path string) Option

func Port

func Port(port int) Option

func Realm

func Realm(realm string) Option

func Scheme

func Scheme(scheme string) Option

func Username

func Username(username string) Option

type Options

type Options struct {
	Host `json:"host" yaml:"host"`
	Auth `json:"auth" yaml:"auth"`
}

Jump to

Keyboard shortcuts

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