internal

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientNotFound = errors.New("client not found")

Functions

This section is empty.

Types

type AuthorizedKeycloak

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

func (*AuthorizedKeycloak) Clients

func (k *AuthorizedKeycloak) Clients(ctx context.Context, realm string) *Clients

func (*AuthorizedKeycloak) Create

func (k *AuthorizedKeycloak) Create(ctx context.Context, realm string, draft ClientDraft) (string, error)

Create new client and return ID.

func (*AuthorizedKeycloak) Delete

func (k *AuthorizedKeycloak) Delete(ctx context.Context, realm, id string) error

func (*AuthorizedKeycloak) Error

func (k *AuthorizedKeycloak) Error() error

func (*AuthorizedKeycloak) Get

func (k *AuthorizedKeycloak) Get(ctx context.Context, realm string, id string) (*ClientDetails, error)

func (*AuthorizedKeycloak) Update

func (k *AuthorizedKeycloak) Update(ctx context.Context, id string, realm string, draft ClientDraft) error

type Client

type Client struct {
	ID                        string   `json:"id"`
	ClientID                  string   `json:"clientId"`
	Name                      string   `json:"name"`
	Description               string   `json:"description,omitempty"`
	AdminURL                  string   `json:"adminUrl,omitempty"`
	RootURL                   string   `json:"rootUrl"`
	BaseURL                   string   `json:"baseUrl"`
	SurrogateAuthRequired     bool     `json:"surrogateAuthRequired"`
	Enabled                   bool     `json:"enabled"`
	AlwaysDisplayInConsole    bool     `json:"alwaysDisplayInConsole"`
	ClientAuthenticatorType   string   `json:"clientAuthenticatorType"`
	RedirectURIs              []string `json:"redirectUris"`
	WebOrigins                []string `json:"webOrigins"`
	NotBefore                 int      `json:"notBefore"`
	BearerOnly                bool     `json:"bearerOnly"`
	ConsentRequired           bool     `json:"consentRequired"`
	StandardFlowEnabled       bool     `json:"standardFlowEnabled"`
	ImplicitFlowEnabled       bool     `json:"implicitFlowEnabled"`
	DirectAccessGrantsEnabled bool     `json:"directAccessGrantsEnabled"`
	ServiceAccountsEnabled    bool     `json:"serviceAccountsEnabled"`
	PublicClient              bool     `json:"publicClient"`
	FrontChannelLogout        bool     `json:"frontchannelLogout"`
	Protocol                  string   `json:"protocol"`
	Attributes                struct {
		PostLogoutRedirectUris string `json:"post.logout.redirect.uris"`
	} `json:"attributes"`
	FullScopeAllowed          bool     `json:"fullScopeAllowed"`
	NodeReRegistrationTimeout int      `json:"nodeReRegistrationTimeout"`
	DefaultClientScopes       []string `json:"defaultClientScopes"`
	OptionalClientScopes      []string `json:"optionalClientScopes"`
	Access                    struct {
		View      bool `json:"view"`
		Configure bool `json:"configure"`
		Manage    bool `json:"manage"`
	} `json:"access"`
}

type ClientDetails

type ClientDetails struct {
	Client
	Secret string `json:"secret"`
}

func Find

func Find(ctx context.Context, kClient *AuthorizedKeycloak, realm string, id, name string) (*ClientDetails, error)

type ClientDraft

type ClientDraft struct {
	ClientID     string   `json:"clientId,omitempty"`
	ClientSecret string   `json:"secret,omitempty"`
	RootURL      string   `json:"rootUrl,omitempty"`
	AdminURL     string   `json:"adminUrl,omitempty"`
	RedirectURIs []string `json:"redirectUris,omitempty"`
	WebOrigins   []string `json:"webOrigins,omitempty"`
	Name         string   `json:"name,omitempty"`
	ID           string   `json:"id,omitempty"`
	Description  string   `json:"description,omitempty"`
}

func Generate

func Generate(domain string) ClientDraft

type Clients

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

func (*Clients) All

func (cl *Clients) All() ([]Client, error)

func (*Clients) ByName

func (cl *Clients) ByName(name string) (Client, error)

func (*Clients) Error

func (cl *Clients) Error() error

func (*Clients) Find

func (cl *Clients) Find(clientID string) (Client, error)

type Keycloak

type Keycloak struct {
	URL      string `required:"true" envconfig:"URL"`
	User     string `required:"true" envconfig:"USER"`
	Password string `required:"true" envconfig:"PASSWORD"`
}

func FromEnv

func FromEnv() (*Keycloak, error)

func (*Keycloak) Authorize

func (k *Keycloak) Authorize(ctx context.Context) *AuthorizedKeycloak

func (*Keycloak) DiscoveryURL

func (k *Keycloak) DiscoveryURL(realm string) string

func (*Keycloak) RealmURL

func (k *Keycloak) RealmURL(realm string) string

Jump to

Keyboard shortcuts

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