keycloak

package
v0.0.0-...-7731033 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMasterRealm  = "master"
	DefaultClientID     = "tks"
	DefaultClientSecret = "secret"
	AdminCliClientID    = "admin-cli"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address       string
	ClientSecret  string
	AdminId       string
	AdminPassword string
}

type IKeycloak

type IKeycloak interface {
	InitializeKeycloak() error

	LoginAdmin(accountId string, password string) (*domain.User, error)
	Login(accountId string, password string, organizationId string) (*domain.User, error)
	Logout(sessionId string, organizationId string) error

	CreateRealm(organizationId string) (string, error)
	GetRealm(organizationId string) (*domain.Organization, error)
	GetRealms() ([]*domain.Organization, error)
	DeleteRealm(organizationId string) error
	UpdateRealm(organizationId string, organizationConfig domain.Organization) error

	CreateUser(organizationId string, user *gocloak.User) error
	GetUser(organizationId string, userAccountId string) (*gocloak.User, error)
	GetUsers(organizationId string) ([]*gocloak.User, error)
	DeleteUser(organizationId string, userAccountId string) error
	UpdateUser(organizationId string, user *gocloak.User) error
	JoinGroup(organizationId string, userId string, groupName string) error
	LeaveGroup(organizationId string, userId string, groupName string) error

	VerifyAccessToken(token string, organizationId string) error
	GetSessions(userId string, organizationId string) (*[]string, error)
}

func New

func New(config *Config) IKeycloak

type Keycloak

type Keycloak struct {
	// contains filtered or unexported fields
}

func (*Keycloak) CreateRealm

func (k *Keycloak) CreateRealm(organizationId string) (string, error)

func (*Keycloak) CreateUser

func (k *Keycloak) CreateUser(organizationId string, user *gocloak.User) error

func (*Keycloak) DeleteRealm

func (k *Keycloak) DeleteRealm(organizationId string) error

func (*Keycloak) DeleteUser

func (k *Keycloak) DeleteUser(organizationId string, userAccountId string) error

func (*Keycloak) GetRealm

func (k *Keycloak) GetRealm(organizationId string) (*domain.Organization, error)

func (*Keycloak) GetRealms

func (k *Keycloak) GetRealms() ([]*domain.Organization, error)

func (*Keycloak) GetSessions

func (k *Keycloak) GetSessions(userId string, organizationId string) (*[]string, error)

func (*Keycloak) GetUser

func (k *Keycloak) GetUser(organizationId string, accountId string) (*gocloak.User, error)

func (*Keycloak) GetUsers

func (k *Keycloak) GetUsers(organizationId string) ([]*gocloak.User, error)

func (*Keycloak) InitializeKeycloak

func (k *Keycloak) InitializeKeycloak() error

func (*Keycloak) JoinGroup

func (k *Keycloak) JoinGroup(organizationId string, userId string, groupName string) error

func (*Keycloak) LeaveGroup

func (k *Keycloak) LeaveGroup(organizationId string, userId string, groupName string) error

func (*Keycloak) Login

func (k *Keycloak) Login(accountId string, password string, organizationId string) (*domain.User, error)

func (*Keycloak) LoginAdmin

func (k *Keycloak) LoginAdmin(accountId string, password string) (*domain.User, error)

func (*Keycloak) Logout

func (k *Keycloak) Logout(sessionId string, organizationId string) error

func (*Keycloak) UpdateRealm

func (k *Keycloak) UpdateRealm(organizationId string, organizationConfig domain.Organization) error

func (*Keycloak) UpdateUser

func (k *Keycloak) UpdateUser(organizationId string, user *gocloak.User) error

func (*Keycloak) VerifyAccessToken

func (k *Keycloak) VerifyAccessToken(token string, organizationId string) error

Jump to

Keyboard shortcuts

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