Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) GetJWT(scope string) (output *v1payload.GetJWTOutput, err error)
- func (c *Client) GetProject(id string) (output *v1payload.GetProjectOutput, err error)
- func (c *Client) GetWorkerJWT(project, scope string) (output *v1payload.GetWorkerJWTOutput, err error)
- func (c *Client) ListProjects() (output *v1payload.ListProjectsOutput, err error)
- type ClientConfig
- type Doer
- type HTTPError
- type OAuthTokenProvider
- type OpsClient
- type OpsClientConfig
- type OpsClientInterface
- type StaticOAuthTokenProvider
- type TokenClient
- type TokenClientConfig
- type TokenClientInterface
Constants ¶
const (
//NCEScope is the JWT scope for the NCE service
NCEScope = "nce.nerdalize.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ClientConfig // contains filtered or unexported fields }
Client is the client for the nerdalize authentication server.
func (*Client) GetJWT ¶
func (c *Client) GetJWT(scope string) (output *v1payload.GetJWTOutput, err error)
GetJWT gets a JWT for a given scope
func (*Client) GetProject ¶ added in v1.0.0
func (c *Client) GetProject(id string) (output *v1payload.GetProjectOutput, err error)
GetProject retrieve a precised project so we can validate its existence and find on which cluster it's living.
func (*Client) GetWorkerJWT ¶
func (c *Client) GetWorkerJWT(project, scope string) (output *v1payload.GetWorkerJWTOutput, err error)
GetWorkerJWT gets a new worker JWT
func (*Client) ListProjects ¶
func (c *Client) ListProjects() (output *v1payload.ListProjectsOutput, err error)
ListProjects lists projects
type ClientConfig ¶
type ClientConfig struct { Doer Doer Base *url.URL OAuthTokenProvider OAuthTokenProvider Logger *log.Logger }
ClientConfig provides config details to create an Auth client.
type HTTPError ¶
HTTPError is an error that is used when a server responded with a status code >= 400. Based on the actual status code a custom error message will be generated.
type OAuthTokenProvider ¶
OAuthTokenProvider is capable of providing a oauth access token. When IsExpired return false the in-memory token will be used to prevent from calling Retrieve for each API call.
type OpsClient ¶
type OpsClient struct {
OpsClientConfig
}
OpsClient is used for a bunch of operations on the auth API that don't require oauth authentication.
func NewOpsClient ¶
func NewOpsClient(c OpsClientConfig) *OpsClient
NewOpsClient creates a new OpsClient.
func (*OpsClient) GetOAuthCredentials ¶
func (c *OpsClient) GetOAuthCredentials(code, clientID, clientSecret, localServerURL string) (output *v1payload.GetOAuthCredentialsOutput, err error)
GetOAuthCredentials gets oauth credentials based on a 'session' code
func (*OpsClient) RefreshOAuthCredentials ¶
func (c *OpsClient) RefreshOAuthCredentials(refreshToken, clientID, clientSecret string) (output *v1payload.RefreshOAuthCredentialsOutput, err error)
RefreshOAuthCredentials refreshes an oauth access token
type OpsClientConfig ¶
OpsClientConfig is the config for OpsClient
type OpsClientInterface ¶
type OpsClientInterface interface { GetOAuthCredentials(code, clientID, clientSecret, localServerURL string) (output *v1payload.GetOAuthCredentialsOutput, err error) RefreshOAuthCredentials(refreshToken, clientID, clientSecret string) (output *v1payload.RefreshOAuthCredentialsOutput, err error) }
OpsClientInterface is an interface so client calls can be mocked.
type StaticOAuthTokenProvider ¶
type StaticOAuthTokenProvider struct {
Token string
}
StaticOAuthTokenProvider is a simple oauth token provider that always returns the same token.
func NewStaticOAuthTokenProvider ¶
func NewStaticOAuthTokenProvider(token string) *StaticOAuthTokenProvider
NewStaticOAuthTokenProvider creates a new StaticOAuthTokenProvider for the given token.
func (*StaticOAuthTokenProvider) IsExpired ¶
func (s *StaticOAuthTokenProvider) IsExpired() bool
IsExpired always returns false.
func (*StaticOAuthTokenProvider) Retrieve ¶
func (s *StaticOAuthTokenProvider) Retrieve() (string, error)
Retrieve always returns the given token.
type TokenClient ¶
type TokenClient struct {
TokenClientConfig
}
TokenClient is used for a bunch of operations on the auth API that don't require oauth authentication.
func NewTokenClient ¶
func NewTokenClient(c TokenClientConfig) *TokenClient
NewTokenClient creates a new TokenClient.
func (*TokenClient) RefreshJWT ¶
func (c *TokenClient) RefreshJWT(projectID, jwt, secret string) (output *v1payload.RefreshWorkerJWTOutput, err error)
RefreshJWT refreshes a JWT with a refresh token
func (*TokenClient) RevokeJWT ¶
func (c *TokenClient) RevokeJWT(projectID, jwt, secret string) (output *v1payload.RefreshWorkerJWTOutput, err error)
RevokeJWT revokes a JWT
type TokenClientConfig ¶
TokenClientConfig is the config for TokenClient
type TokenClientInterface ¶
type TokenClientInterface interface { RefreshJWT(projectID, jwt, secret string) (output *v1payload.RefreshWorkerJWTOutput, err error) RevokeJWT(projectID, jwt, secret string) (output *v1payload.RefreshWorkerJWTOutput, err error) }
TokenClientInterface is an interface so client calls can be mocked.