uaac

package
v0.0.0-...-dd752a8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenDecodeError = errors.New("Failed to decode token")
	JSONParseError   = errors.New("Failed to parse JSON")
)
View Source
var (
	DEBUG = false
)

Functions

func GetClient

func GetClient(client Client) *http.Client

Types

type Client

type Client struct {
	Host              string
	BasicAuthUsername string
	BasicAuthPassword string
	AccessToken       string
	VerifySSL         bool
}

Http Client, wraps go's http.Client for our usecase

func NewClient

func NewClient(host string, verifySSL bool) Client

func (Client) MakeRequest

func (client Client) MakeRequest(method, path string, requestBody io.Reader) (int, []byte, error)

Make request with the given basic auth and ssl settings, returns reponse code and body as a byte array

func (Client) TLSConfig

func (client Client) TLSConfig() *tls.Config

func (Client) WithAuthorizationToken

func (client Client) WithAuthorizationToken(token string) Client

func (Client) WithBasicAuthCredentials

func (client Client) WithBasicAuthCredentials(clientID, clientSecret string) Client

type Token

type Token struct {
	Access  string `json:"access_token"`
	Refresh string `json:"refresh_token"`
}

Encapsulates the access and refresh tokens from UAA

func NewToken

func NewToken() Token

func UAAClient

func UAAClient() (Token, error)

func (Token) IsExpired

func (token Token) IsExpired() (bool, error)

Determines if the token has expired

func (Token) IsPresent

func (token Token) IsPresent() bool

Determines if all the token's information is present

func (Token) Type

func (token Token) Type() string

type UAAEnvironment

type UAAEnvironment struct {
	Domain          string
	Scheme          string `env:"SCHEME"               `
	UAAClientID     string `env:"UAA_CLIENT_ID"        `
	UAAClientSecret string `env:"UAA_CLIENT_SECRET"    `
	UAAHost         string `env:"UAA_HOST"             `
	VerifySSL       bool   `env:"VERIFY_SSL"           `
}

func UaaEnvironment

func UaaEnvironment() UAAEnvironment

Jump to

Keyboard shortcuts

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