authUtils

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CloseApp sync.WaitGroup
)

Functions

func BuildAuthorizationRequest

func BuildAuthorizationRequest(config Config) string

func BuildLogoutRequest added in v0.1.4

func BuildLogoutRequest(keycloakConfig KeycloakConfig, accessToken string, refreshToken string) (*http.Request, error)

func BuildRefreshRequest

func BuildRefreshRequest(keycloakConfig KeycloakConfig, refreshToken string) (*http.Request, error)

func BuildTokenExchangeRequest

func BuildTokenExchangeRequest(config Config, code string) (*http.Request, error)

func InitConfig

func InitConfig() error

func IsTokenExpired

func IsTokenExpired(token *string) (bool, error)

func Logout added in v0.1.4

func Logout(config *Config) error

func OpenBrowser

func OpenBrowser(url string) error

func RefreshAccessToken

func RefreshAccessToken(config *Config) error

func SaveConfig

func SaveConfig(cfg *IConfig) error

func StartServer

func StartServer(config Config)

Types

type Config

type Config struct {
	KeycloakConfig       KeycloakConfig
	EmbeddedServerConfig EmbeddedServerConfig
}

type EmbeddedServerConfig

type EmbeddedServerConfig struct {
	Port         uint32
	CallbackPath string
}

func (*EmbeddedServerConfig) GetCallbackURL

func (c *EmbeddedServerConfig) GetCallbackURL() string

type IConfig

type IConfig struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ServerURL    string `json:"server_url"`
	SingleUser   string `json:"single_user"`
}

func GetConfig

func GetConfig() (IConfig, error)

type KeycloakConfig

type KeycloakConfig struct {
	KeycloakURL string
	Realm       string
	ClientID    string
}

Jump to

Keyboard shortcuts

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