security

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: EPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CodewindCliID string = "codewind-cli"

CodewindCliID : master realm name

View Source
const CodewindClientID string = "codewind-backend"

CodewindClientID : master realm name

View Source
const KeycloakAdminClientID string = "admin-cli"

KeycloakAdminClientID : master realm name

View Source
const KeycloakMasterRealm string = "master"

KeycloakMasterRealm : master realm name

View Source
const KeyringServiceName string = "org.eclipse.codewind"

KeyringServiceName : name

Variables

This section is empty.

Functions

func GetPathToInsecureKeyring

func GetPathToInsecureKeyring() string

GetPathToInsecureKeyring gets the path to the insecureKeychain.json

func GetServerInfo

func GetServerInfo(keycloakHostname string, accesstoken string) (*ServerInfo, *SecError)

GetServerInfo - fetch Keycloak server info

func IsSecretNotFoundError

func IsSecretNotFoundError(se *SecError) bool

IsSecretNotFoundError : Test whether a secret error is due to the secret not existing.

func SecAuthenticate

func SecAuthenticate(httpClient utils.HTTPClient, c *cli.Context, connectionRealm string, connectionClient string) (*AuthToken, *SecError)

SecAuthenticate - sends credentials to the auth server for a specific realm and returns an AuthToken connectionRealm can be used to override the supplied context arguments

func SecClientGet

func SecClientGet(c *cli.Context) (*RegisteredClient, *SecError)

SecClientGet : Retrieve Client information

func SecClientGetSecret

func SecClientGetSecret(c *cli.Context) (*RegisteredClientSecret, *SecError)

SecClientGetSecret : Retrieve the client secret for the supplied clientID

func SecRealmGet

func SecRealmGet(authURL string, accessToken string, realmName string) (*KeycloakRealm, *SecError)

SecRealmGet : Reads a realm in Keycloak

func SecRefreshAccessToken

func SecRefreshAccessToken(httpClient utils.HTTPClient, connection *connections.Connection, refreshToken string) (*AuthToken, *SecError)

SecRefreshAccessToken : Obtain an access token using a refresh token

func SecRefreshTokens

func SecRefreshTokens(httpClient utils.HTTPClient, c *cli.Context) (*AuthToken, *SecError)

SecRefreshTokens : Retrieve new tokens using the cached refresh token

func SecUserGet

func SecUserGet(c *cli.Context) (*RegisteredUser, *SecError)

SecUserGet : Get user from Keycloak

Types

type AuthToken

type AuthToken struct {
	AccessToken     string `json:"access_token"`
	ExpiresIn       int    `json:"expires_in"`
	RefreshToken    string `json:"refresh_token"`
	TokenType       string `json:"token_type"`
	NotBeforePolicy int    `json:"not-before-policy"`
	SessionState    string `json:"session_state"`
	Scope           string `json:"scope"`
}

AuthToken from the keycloak server after successfully authenticating

type ClientMockAuthenticate

type ClientMockAuthenticate struct {
	StatusCode int
	Body       io.ReadCloser
}

ClientMockAuthenticate : Client Mock with a concrete response and status code

func (*ClientMockAuthenticate) Do

Do : perform do function

type ClientMockRequestFail

type ClientMockRequestFail struct {
}

func (*ClientMockRequestFail) Do

Do : perform do function

type KeycloakAPIError

type KeycloakAPIError struct {
	HTTPStatus       int
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	ErrorMessage     string `json:"errorMessage"`
}

KeycloakAPIError : Error responses from Keycloak

type KeycloakRealm

type KeycloakRealm struct {
	ID          string `json:"id"`
	Realm       string `json:"realm"`
	DisplayName string `json:"displayName"`
	Enabled     bool   `json:"enabled"`
	LoginTheme  string `json:"loginTheme"`
}

KeycloakRealm : A Keycloak Realm

type KeyringSecret

type KeyringSecret struct {
	Service  []byte `json:"service"`
	Username []byte `json:"username"`
	Password []byte `json:"password"`
}

KeyringSecret : Secret

type RegisteredClient

type RegisteredClient struct {
	ID           string   `json:"id"`
	ClientID     string   `json:"clientId"`
	Name         string   `json:"name"`
	RedirectUris []string `json:"redirectUris"`
	WebOrigins   []string `json:"webOrigins"`
}

RegisteredClient : Registered client

type RegisteredClientSecret

type RegisteredClientSecret struct {
	Type   string `json:"type"`
	Secret string `json:"value"`
}

RegisteredClientSecret : Client secret

type RegisteredClients

type RegisteredClients struct {
	Collection []RegisteredClient
}

RegisteredClients : A collection of registered clients

type RegisteredTheme

type RegisteredTheme struct {
	Name    string   `json:"name"`
	Locales []string `json:"locales"`
}

RegisteredTheme : A Keycloak theme

type RegisteredThemes

type RegisteredThemes struct {
	Common  []RegisteredTheme `json:"common"`
	Admin   []RegisteredTheme `json:"admin"`
	Login   []RegisteredTheme `json:"login"`
	Welcome []RegisteredTheme `json:"welcome"`
	Account []RegisteredTheme `json:"account"`
	Email   []RegisteredTheme `json:"email"`
}

RegisteredThemes : A collection of themes

type RegisteredUser

type RegisteredUser struct {
	ID       string `json:"id"`
	Username string `json:"username"`
}

RegisteredUser : details of a registered user

type RegisteredUsers

type RegisteredUsers struct {
	Collection []RegisteredUser
}

RegisteredUsers : A collection of registered users

type Result

type Result struct {
	Status string `json:"status"`
}

Result : status messaqe

type Role

type Role struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Composite   bool   `json:"composite"`
	ClientRole  bool   `json:"clientRole"`
	ContainerID string `json:"containerId"`
}

Role : Access role

type SecError

type SecError struct {
	Op   string
	Err  error
	Desc string
}

SecError : Security package errors

func DeleteSecretFromKeyring

func DeleteSecretFromKeyring(connectionID, uName string) *SecError

DeleteSecretFromKeyring deletes the secret from either the system keyring or our insecure keyring.

func GetSecretFromKeyring

func GetSecretFromKeyring(connectionID, uName string) (string, *SecError)

GetSecretFromKeyring gets the secret from either the system keyring or our insecure keyring.

func GetSuggestedThemes added in v0.14.0

func GetSuggestedThemes(keycloakHostname string, accesstoken string) (string, string, *SecError)

GetSuggestedThemes - Recommends the Codewind theme, else Che, else keycloak default Returns the loginTheme, accountTheme, optionalError

func SecClientAppendURL

func SecClientAppendURL(c *cli.Context, gatekeeperURL string) *SecError

SecClientAppendURL : Append an additional url to the whitelist

func SecClientCreate

func SecClientCreate(c *cli.Context) *SecError

SecClientCreate : Create a new client in Keycloak

func SecKeyGetSecret

func SecKeyGetSecret(connectionID, username string) (string, *SecError)

SecKeyGetSecret : retrieve secret / credentials from the keyring

func SecKeyUpdate

func SecKeyUpdate(connectionID string, username string, password string) *SecError

SecKeyUpdate : Creates or updates a key in the platforms keyring

func SecRealmCreate

func SecRealmCreate(c *cli.Context) *SecError

SecRealmCreate : Create a new realm in Keycloak

func SecRoleCreate

func SecRoleCreate(c *cli.Context) *SecError

SecRoleCreate : Create a new role in Keycloak

func SecUserAddRole

func SecUserAddRole(c *cli.Context) *SecError

SecUserAddRole : Adds a role to a specified user

func SecUserCreate

func SecUserCreate(c *cli.Context) *SecError

SecUserCreate : Create a new realm in Keycloak

func SecUserSetPW

func SecUserSetPW(c *cli.Context) *SecError

SecUserSetPW : Resets the users password in keycloak to a new one supplied

func StoreSecretInKeyring

func StoreSecretInKeyring(connectionID, uName, pass string) *SecError

StoreSecretInKeyring stores the secret in either the system keyring or our insecure keyring.

func (*SecError) Error

func (se *SecError) Error() string

SecError : Error formatted in JSON containing an errorOp and a description from either a fault condition in the CLI, or an error payload from a REST request

type ServerInfo

type ServerInfo struct {
	Themes RegisteredThemes `json:"themes"`
}

ServerInfo : A collection of themes

Jump to

Keyboard shortcuts

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