Documentation ¶
Index ¶
- type AccessToken
- type AccessTokenImpl
- type AccessTokenSession
- type Client
- type ClientRequest
- type ClientTokenSession
- type Config
- type ConfigUpdater
- type Factory
- type Prompt
- type PromptAnswer
- type PromptSorting
- type PromptsResp
- type RefreshableAccessToken
- type RefreshableAccessTokenImpl
- type Token
- type TokenInfo
- type TokenResp
- type UAA
- type UAAImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken interface { Token }
AccessToken is purely an access token. It does not contain a refresh token and cannot be refreshed for another token.
func NewAccessToken ¶
func NewAccessToken(accessValueType, accessValue string) AccessToken
type AccessTokenImpl ¶
type AccessTokenImpl struct {
// contains filtered or unexported fields
}
func (AccessTokenImpl) IsValid ¶
func (t AccessTokenImpl) IsValid() bool
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(uaa UAA, token AccessToken, config ConfigUpdater, environment string) *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 *httpclient.HTTPClient, logger boshlog.Logger) Client
func (Client) ClientCredentialsGrant ¶
func (Client) OwnerPasswordCredentialsGrant ¶
func (c Client) OwnerPasswordCredentialsGrant(answers []PromptAnswer) (TokenResp, error)
func (Client) Prompts ¶
func (c Client) Prompts() (PromptsResp, error)
type ClientRequest ¶
type ClientRequest struct {
// contains filtered or unexported fields
}
func NewClientRequest ¶
func NewClientRequest( endpoint string, client string, clientSecret string, httpClient *httpclient.HTTPClient, logger boshlog.Logger, ) ClientRequest
func (ClientRequest) Get ¶
func (r ClientRequest) Get(path string, response interface{}) error
type ClientTokenSession ¶
type ClientTokenSession struct {
// contains filtered or unexported fields
}
func NewClientTokenSession ¶
func NewClientTokenSession(uaa UAA) *ClientTokenSession
type Config ¶
type Config struct { Host string Port int Path string Client string ClientSecret string CACert string }
func NewConfigFromURL ¶
type ConfigUpdater ¶
type ConfigUpdater interface { UpdateConfigWithToken(environment string, token AccessToken) error Save() 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 ¶
type PromptAnswer ¶
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 RefreshableAccessToken ¶
type RefreshableAccessToken interface { AccessToken RefreshValue() string }
RefreshableAccessToken is an access token with a refresh token that can be used to get another access token.
func NewRefreshableAccessToken ¶
func NewRefreshableAccessToken(accessValueType, accessValue, refreshValue string) RefreshableAccessToken
type RefreshableAccessTokenImpl ¶
type RefreshableAccessTokenImpl struct {
// contains filtered or unexported fields
}
func (RefreshableAccessTokenImpl) IsValid ¶
func (t RefreshableAccessTokenImpl) IsValid() bool
func (RefreshableAccessTokenImpl) RefreshValue ¶
func (t RefreshableAccessTokenImpl) RefreshValue() string
func (RefreshableAccessTokenImpl) Type ¶
func (t RefreshableAccessTokenImpl) Type() string
func (RefreshableAccessTokenImpl) Value ¶
func (t RefreshableAccessTokenImpl) 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 ¶
type UAA ¶
type UAA interface { Prompts() ([]Prompt, error) RefreshTokenGrant(string) (AccessToken, error) ClientCredentialsGrant() (AccessToken, error) OwnerPasswordCredentialsGrant([]PromptAnswer) (AccessToken, error) }
type UAAImpl ¶
type UAAImpl struct {
// contains filtered or unexported fields
}
func (UAAImpl) ClientCredentialsGrant ¶
func (u UAAImpl) ClientCredentialsGrant() (AccessToken, error)
func (UAAImpl) OwnerPasswordCredentialsGrant ¶
func (u UAAImpl) OwnerPasswordCredentialsGrant(answers []PromptAnswer) (AccessToken, error)
func (UAAImpl) RefreshTokenGrant ¶
func (u UAAImpl) RefreshTokenGrant(refreshValue string) (AccessToken, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.