apiserver

package
v0.0.99 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: UPL-1.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthHandler

func AuthHandler(h http.Handler) http.Handler

AuthHandler setups handler for API server HTTP requests.

func CORSHandler

func CORSHandler(h http.Handler) http.Handler

CORSHandler is an HTTP handler that will handle CORS preflight requests or delegate to the actual handler on real requests

func EnableCors

func EnableCors(w *http.ResponseWriter)

EnableCors adds headers necessary for the browser running the UI to be able to call the API server

func HTTPError added in v0.0.99

func HTTPError(w http.ResponseWriter, statusCode int, code, message string)

HTTPError replies to the request with the specified error message and HTTP code.

func Init

func Init(listers controller.Listers)

Init initializes set of Listers for API server.

func InternalServerError

func InternalServerError(w http.ResponseWriter, message string)

InternalServerError replies to request with InternalServerError.

func SetRealm

func SetRealm(realm string)

SetRealm sets the the realm for API server.

func SetupOptionsResponse

func SetupOptionsResponse(w *http.ResponseWriter, req *http.Request)

SetupOptionsResponse creates the headers that are needed for a HTTP OPTIONS request The web UI makes an OPTIONS request before each GET/POST/etc.

Types

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error represents an error structure for HTTP errors.

type JSONWebKey added in v0.0.99

type JSONWebKey struct {
	KeyID            string   `json:"kid"`
	KeyType          string   `json:"kty"`
	Algorithm        string   `json:"alg"`
	CertificateChain []string `json:"x5c"`
}

JSONWebKey represents a cryptographic key. https://tools.ietf.org/html/rfc7517#section-4.7 JsonWebKey

type KeyCloak

type KeyCloak struct {
	Endpoint string
	Realm    string
	// contains filtered or unexported fields
}

KeyCloak represents a KeyCloak instance.

func (*KeyCloak) GetPublicKey added in v0.0.99

func (kc *KeyCloak) GetPublicKey(kid string) (*rsa.PublicKey, error)

GetPublicKey returns a public key.

func (*KeyCloak) GetPublicKeys added in v0.0.99

func (kc *KeyCloak) GetPublicKeys() (bool, error)

GetPublicKeys returns boolean whether public keys exist or not.

type KeyRepo

type KeyRepo interface {
	GetPublicKey(kid string) (*rsa.PublicKey, error)
	GetPublicKeys() (bool, error)
}

KeyRepo defines interface to get public keys.

func NewKeyCloak

func NewKeyCloak(url, realm string) KeyRepo

NewKeyCloak creates a KeyCloak struct.

type PublicKeys

type PublicKeys struct {
	Keys []JSONWebKey `json:"keys"`
}

PublicKeys represents json public keys.

Jump to

Keyboard shortcuts

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