uaa

package
v0.0.106 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken interface {
	Token
	RefreshToken() Token
	Refresh() (AccessToken, error)
}

AccessToken is a token that can be refreshed.

type AccessTokenImpl

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

func (AccessTokenImpl) Refresh

func (t AccessTokenImpl) Refresh() (AccessToken, error)

func (AccessTokenImpl) RefreshToken

func (t AccessTokenImpl) RefreshToken() Token

func (AccessTokenImpl) Type

func (t AccessTokenImpl) Type() string

func (AccessTokenImpl) Value

func (t AccessTokenImpl) Value() string

type AccessTokenSession

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

func NewAccessTokenSession

func NewAccessTokenSession(accessToken StaleAccessToken) *AccessTokenSession

func (*AccessTokenSession) TokenFunc

func (s *AccessTokenSession) TokenFunc(retried bool) (string, error)

TokenFunc retrieves new access token on first time use instead of using existing access token optimizing for token being valid for a longer period of time. Subsequent calls will reuse access token until it's time for it to be refreshed.

type Client

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

func NewClient

func NewClient(endpoint string, client string, clientSecret string, httpClient boshhttp.HTTPClient, logger boshlog.Logger) Client

func (Client) ClientCredentialsGrant

func (c Client) ClientCredentialsGrant() (TokenResp, error)

func (Client) OwnerPasswordCredentialsGrant

func (c Client) OwnerPasswordCredentialsGrant(answers []PromptAnswer) (TokenResp, error)

func (Client) Prompts

func (c Client) Prompts() (PromptsResp, error)

func (Client) RefreshTokenGrant

func (c Client) RefreshTokenGrant(refreshValue string) (TokenResp, error)

type ClientRequest

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

func NewClientRequest

func NewClientRequest(
	endpoint string,
	client string,
	clientSecret string,
	httpClient boshhttp.HTTPClient,
	logger boshlog.Logger,
) ClientRequest

func (ClientRequest) Get

func (r ClientRequest) Get(path string, response interface{}) error

func (ClientRequest) Post

func (r ClientRequest) Post(path string, payload []byte, response interface{}) error

type ClientTokenSession

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

func NewClientTokenSession

func NewClientTokenSession(uaa UAA) *ClientTokenSession

func (*ClientTokenSession) TokenFunc

func (c *ClientTokenSession) TokenFunc(retried bool) (string, error)

type Config

type Config struct {
	Host string
	Port int
	Path string

	Client       string
	ClientSecret string

	CACert string
}

func NewConfigFromURL

func NewConfigFromURL(url string) (Config, error)

func (Config) CACertPool

func (c Config) CACertPool() (*x509.CertPool, error)

func (Config) Validate

func (c Config) Validate() error

type Factory

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

func NewFactory

func NewFactory(logger boshlog.Logger) Factory

func (Factory) New

func (f Factory) New(config Config) (UAA, error)

type Prompt

type Prompt struct {
	Key   string // e.g. "username"
	Type  string // e.g. "text", "password"
	Label string // e.g. "Username"
}

func (Prompt) IsPassword

func (p Prompt) IsPassword() bool

type PromptAnswer

type PromptAnswer struct {
	Key   string // e.g. "username"
	Value string
}

type PromptSorting

type PromptSorting []Prompt

func (PromptSorting) Len

func (s PromptSorting) Len() int

func (PromptSorting) Less

func (s PromptSorting) Less(i, j int) bool

func (PromptSorting) Swap

func (s PromptSorting) Swap(i, j int)

type PromptsResp

type PromptsResp struct {
	Prompts map[string][]string // e.g. {"username": ["text", "Username"]}
}

type StaleAccessToken

type StaleAccessToken interface {
	RefreshToken() Token
	Refresh() (AccessToken, error)
}

StaleAccessToken represents a token that should only be refreshed. Its value cannot be retrieved since it's stale hence should not be used.

type Token

type Token interface {
	Type() string
	Value() string
}

Token is a plain token with a value.

type TokenImpl

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

func (TokenImpl) Type

func (t TokenImpl) Type() string

func (TokenImpl) Value

func (t TokenImpl) Value() string

type TokenInfo

type TokenInfo struct {
	Username  string   `json:"user_name"` // e.g. "admin",
	Scopes    []string `json:"scope"`     // e.g. ["openid","bosh.admin"]
	ExpiredAt int      `json:"exp"`
}

func NewTokenInfoFromValue

func NewTokenInfoFromValue(value string) (TokenInfo, error)

type TokenResp

type TokenResp struct {
	Type         string `json:"token_type"`    // e.g. "bearer"
	AccessToken  string `json:"access_token"`  // e.g. "eyJhbGciOiJSUzI1NiJ9.eyJq<snip>fQ.Mr<snip>RawG"
	RefreshToken string `json:"refresh_token"` // e.g. "eyJhbGciOiJSUzI1NiJ9.eyJq<snip>fQ.Mr<snip>RawG"
}

type UAA

type UAA interface {
	NewStaleAccessToken(refreshValue string) StaleAccessToken

	Prompts() ([]Prompt, error)

	ClientCredentialsGrant() (Token, error)
	OwnerPasswordCredentialsGrant([]PromptAnswer) (AccessToken, error)
}

type UAAImpl

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

func (UAAImpl) ClientCredentialsGrant

func (u UAAImpl) ClientCredentialsGrant() (Token, error)

func (UAAImpl) NewStaleAccessToken

func (u UAAImpl) NewStaleAccessToken(refreshValue string) StaleAccessToken

func (UAAImpl) OwnerPasswordCredentialsGrant

func (u UAAImpl) OwnerPasswordCredentialsGrant(answers []PromptAnswer) (AccessToken, error)

func (UAAImpl) Prompts

func (u UAAImpl) Prompts() ([]Prompt, error)

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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