client

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeOauth2ProviderPath

func AuthorizeOauth2ProviderPath() string

AuthorizeOauth2ProviderPath computes a request path to the authorize action of oauth2_provider.

func ConfirmAuthorizationAuthUIPath

func ConfirmAuthorizationAuthUIPath() string

ConfirmAuthorizationAuthUIPath computes a request path to the confirmAuthorization action of authUI.

func GetTokenOauth2ProviderPath

func GetTokenOauth2ProviderPath() string

GetTokenOauth2ProviderPath computes a request path to the get_token action of oauth2_provider.

func PromptAuthorizationAuthUIPath

func PromptAuthorizationAuthUIPath() string

PromptAuthorizationAuthUIPath computes a request path to the promptAuthorization action of authUI.

func ShowLoginLoginPath

func ShowLoginLoginPath() string

ShowLoginLoginPath computes a request path to the showLogin action of login.

Types

type Client

type Client struct {
	*goaclient.Client
	Oauth2ClientBasicAuthSigner goaclient.Signer
	OAuth2Signer                goaclient.Signer
	Encoder                     *goa.HTTPEncoder
	Decoder                     *goa.HTTPDecoder
}

Client is the service client.

func New

func New(c goaclient.Doer) *Client

New instantiates the client.

func (*Client) AuthorizeOauth2Provider

func (c *Client) AuthorizeOauth2Provider(ctx context.Context, path string, clientID string, responseType string, redirectURI *string, scope *string, state *string) (*http.Response, error)

Authorize OAuth2 client

func (*Client) ConfirmAuthorizationAuthUI

func (c *Client) ConfirmAuthorizationAuthUI(ctx context.Context, path string, confirmed *bool) (*http.Response, error)

Confirm the authorization of the client

func (*Client) DecodeErrorResponse

func (c *Client) DecodeErrorResponse(resp *http.Response) (*goa.ErrorResponse, error)

DecodeErrorResponse decodes the ErrorResponse instance encoded in resp body.

func (*Client) DecodeOAuth2ErrorMedia

func (c *Client) DecodeOAuth2ErrorMedia(resp *http.Response) (*OAuth2ErrorMedia, error)

DecodeOAuth2ErrorMedia decodes the OAuth2ErrorMedia instance encoded in resp body.

func (*Client) DecodeTokenMedia

func (c *Client) DecodeTokenMedia(resp *http.Response) (*TokenMedia, error)

DecodeTokenMedia decodes the TokenMedia instance encoded in resp body.

func (*Client) DownloadCSS

func (c *Client) DownloadCSS(ctx context.Context, filename, dest string) (int64, error)

DownloadCSS downloads /files with the given filename and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) DownloadJs

func (c *Client) DownloadJs(ctx context.Context, filename, dest string) (int64, error)

DownloadJs downloads /files with the given filename and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) GetTokenOauth2Provider

func (c *Client) GetTokenOauth2Provider(ctx context.Context, path string, payload *TokenPayload, contentType string) (*http.Response, error)

Get access token from authorization code or refresh token

func (*Client) NewAuthorizeOauth2ProviderRequest

func (c *Client) NewAuthorizeOauth2ProviderRequest(ctx context.Context, path string, clientID string, responseType string, redirectURI *string, scope *string, state *string) (*http.Request, error)

NewAuthorizeOauth2ProviderRequest create the request corresponding to the authorize action endpoint of the oauth2_provider resource.

func (*Client) NewConfirmAuthorizationAuthUIRequest

func (c *Client) NewConfirmAuthorizationAuthUIRequest(ctx context.Context, path string, confirmed *bool) (*http.Request, error)

NewConfirmAuthorizationAuthUIRequest create the request corresponding to the confirmAuthorization action endpoint of the authUI resource.

func (*Client) NewGetTokenOauth2ProviderRequest

func (c *Client) NewGetTokenOauth2ProviderRequest(ctx context.Context, path string, payload *TokenPayload, contentType string) (*http.Request, error)

NewGetTokenOauth2ProviderRequest create the request corresponding to the get_token action endpoint of the oauth2_provider resource.

func (*Client) NewPromptAuthorizationAuthUIRequest

func (c *Client) NewPromptAuthorizationAuthUIRequest(ctx context.Context, path string) (*http.Request, error)

NewPromptAuthorizationAuthUIRequest create the request corresponding to the promptAuthorization action endpoint of the authUI resource.

func (*Client) NewShowLoginLoginRequest

func (c *Client) NewShowLoginLoginRequest(ctx context.Context, path string) (*http.Request, error)

NewShowLoginLoginRequest create the request corresponding to the showLogin action endpoint of the login resource.

func (*Client) PromptAuthorizationAuthUI

func (c *Client) PromptAuthorizationAuthUI(ctx context.Context, path string) (*http.Response, error)

Prompt the user for client authorization

func (*Client) SetOAuth2Signer

func (c *Client) SetOAuth2Signer(signer goaclient.Signer)

SetOAuth2Signer sets the request signer for the OAuth2 security scheme.

func (*Client) SetOauth2ClientBasicAuthSigner

func (c *Client) SetOauth2ClientBasicAuthSigner(signer goaclient.Signer)

SetOauth2ClientBasicAuthSigner sets the request signer for the oauth2_client_basic_auth security scheme.

func (*Client) ShowLoginLogin

func (c *Client) ShowLoginLogin(ctx context.Context, path string) (*http.Response, error)

Shows a login screen

type OAuth2ErrorMedia

type OAuth2ErrorMedia struct {
	// Error returned by authorization server
	Error string `form:"error" json:"error" xml:"error"`
	// Human readable ASCII text providing additional information
	ErrorDescription *string `form:"error_description,omitempty" json:"error_description,omitempty" xml:"error_description,omitempty"`
	// A URI identifying a human-readable web page with information about the error
	ErrorURI *string `form:"error_uri,omitempty" json:"error_uri,omitempty" xml:"error_uri,omitempty"`
}

OAuth2 error response, see https://tools.ietf.org/html/rfc6749#section-5.2 (default view)

Identifier: application/vnd.goa.example.oauth2.error+json; view=default

func (*OAuth2ErrorMedia) Validate

func (mt *OAuth2ErrorMedia) Validate() (err error)

Validate validates the OAuth2ErrorMedia media type instance.

type TokenMedia

type TokenMedia struct {
	// The access token issued by the authorization server
	AccessToken string `form:"access_token" json:"access_token" xml:"access_token"`
	// The lifetime in seconds of the access token
	ExpiresIn *int `form:"expires_in,omitempty" json:"expires_in,omitempty" xml:"expires_in,omitempty"`
	// The refresh token
	RefreshToken *string `form:"refresh_token,omitempty" json:"refresh_token,omitempty" xml:"refresh_token,omitempty"`
	// The scope of the access token
	Scope *string `form:"scope,omitempty" json:"scope,omitempty" xml:"scope,omitempty"`
	// The type of the token issued, e.g. "bearer" or "mac"
	TokenType string `form:"token_type" json:"token_type" xml:"token_type"`
}

OAuth2 access token request successful response, see https://tools.ietf.org/html/rfc6749#section-5.1 (default view)

Identifier: application/vnd.goa.example.oauth2.token+json; view=default

func (*TokenMedia) Validate

func (mt *TokenMedia) Validate() (err error)

Validate validates the TokenMedia media type instance.

type TokenPayload

type TokenPayload struct {
	// The authorization code received from the authorization server, used for initial refresh and access token request
	Code *string `form:"code,omitempty" json:"code,omitempty" xml:"code,omitempty"`
	// Value MUST be set to "authorization_code" when obtaining initial refresh and access token.
	// Value MUST be set to "refresh_token" when refreshing an access token.
	GrantType string `form:"grant_type" json:"grant_type" xml:"grant_type"`
	// The redirect_uri parameter specified when making the authorize request to obtain the authorization code, used for initial refresh and access token request
	RedirectURI *string `form:"redirect_uri,omitempty" json:"redirect_uri,omitempty" xml:"redirect_uri,omitempty"`
	// The refresh token issued to the client, used for refreshing an access token
	RefreshToken *string `form:"refresh_token,omitempty" json:"refresh_token,omitempty" xml:"refresh_token,omitempty"`
	// The scope of the access request, used for refreshing an access token
	Scope *string `form:"scope,omitempty" json:"scope,omitempty" xml:"scope,omitempty"`
}

Payload sent by client to obtain refresh and access token or to refresh an access token. see https://tools.ietf.org/html/rfc6749#section-4.1.3 and https://tools.ietf.org/html/rfc6749#section-6

func (*TokenPayload) Validate

func (ut *TokenPayload) Validate() (err error)

Validate validates the TokenPayload type instance.

Jump to

Keyboard shortcuts

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