keycloak

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Master realm name - typically named as master
	MasterRealmName = "master"

	// AdminClientID - client id to be used for creating Admin Client
	AdminClientID = "admin-cli"
)

Variables

This section is empty.

Functions

func IsConflictError

func IsConflictError(err error) bool

Types

type Client

type Client struct {

	// gocloak lib handle
	gocloak.GoCloak
	// contains filtered or unexported fields
}

func New

func New(url string) (*Client, error)

create a new keycloak client for given endpoint and credentials

func NewPublicClient

func NewPublicClient(url string) *Client

create a new unauthenticated public keycloak client for given endpoint typically will be consumed by public authentication validators

Public client is required only to be consumed by OIDC verifier for validating the provided token and usage is expected to be restricted to auth gateway internal use only

func NewUserClient

func NewUserClient(url, realm, user, password string, skipTlsVerify bool) (*Client, error)

create a new keycloak client for given endpoint and user credentials This requires direct flow validations enabled, which typically is not considered secure and is not recommended for production scenarios, more to be used in development environment. where direct flow enablement needs to be done manually

func (*Client) GetAccessToken

func (c *Client) GetAccessToken() (string, error)

Gets the current access token from the client

func (*Client) GetClientUserSessionsCount

func (c *Client) GetClientUserSessionsCount(ctx context.Context, token, realm, idOfClient string) (int, error)

GetClientUserSessions returns user sessions associated with the client

func (*Client) Logout

func (c *Client) Logout(ctx context.Context) error

Logout and Close the existing Keycloak Client and session

Jump to

Keyboard shortcuts

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