Documentation ¶
Index ¶
- Constants
- func GeneratePKCE() (string, string, string, error)
- func PopulatePKCE(c *ClientConfig) error
- type AccessData
- type AccessRequest
- type AccessRequestType
- type AuthorizeData
- type AuthorizeRequest
- type AuthorizeRequestType
- type BasicAuth
- type Client
- type ClientConfig
- type CustomData
- type CustomRequest
- type Error
- type ResponseData
Constants ¶
View Source
const ( AUTHORIZATION_CODE AccessRequestType = "authorization_code" REFRESH_TOKEN = "refresh_token" PASSWORD = "password" CLIENT_CREDENTIALS = "client_credentials" IMPLICIT = "__implicit" )
View Source
const ( E_INVALID_REQUEST string = "invalid_request" E_UNAUTHORIZED_CLIENT = "unauthorized_client" E_ACCESS_DENIED = "access_denied" E_UNSUPPORTED_RESPONSE_TYPE = "unsupported_response_type" E_INVALID_SCOPE = "invalid_scope" E_SERVER_ERROR = "server_error" E_TEMPORARILY_UNAVAILABLE = "temporarily_unavailable" E_UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type" E_INVALID_GRANT = "invalid_grant" E_INVALID_CLIENT = "invalid_client" )
Variables ¶
This section is empty.
Functions ¶
func PopulatePKCE ¶
func PopulatePKCE(c *ClientConfig) error
Types ¶
type AccessData ¶
type AccessData struct { TokenType string AccessToken string RefreshToken string Expiration *int32 ResponseData ResponseData }
Access data
type AccessRequest ¶
type AccessRequest struct { Type AccessRequestType AuthorizeData *AuthorizeData CustomParameters map[string]string // contains filtered or unexported fields }
Access request information
func (*AccessRequest) GetToken ¶
func (c *AccessRequest) GetToken() (*AccessData, error)
Send a token request and capture data. On OAuth2 error, and osincli.Error is returned as error
func (*AccessRequest) GetTokenUrl ¶
func (c *AccessRequest) GetTokenUrl() *url.URL
Generate a token url. This may not be the exact url that is used, as it may be submited with basic authentication or form-encoded.
type AccessRequestType ¶
type AccessRequestType string
type AuthorizeData ¶
type AuthorizeData struct { Code string State string // Resource Owner Password Credentials Username string Password string }
Authorization data
type AuthorizeRequest ¶
type AuthorizeRequest struct { Type AuthorizeRequestType CustomParameters map[string]string // contains filtered or unexported fields }
Authorize request information
func (*AuthorizeRequest) GetAuthorizeUrl ¶
func (c *AuthorizeRequest) GetAuthorizeUrl() *url.URL
Returns the authorize url
func (*AuthorizeRequest) GetAuthorizeUrlWithParams ¶
func (c *AuthorizeRequest) GetAuthorizeUrlWithParams(state string) *url.URL
Returns the authorize url
func (*AuthorizeRequest) HandleRequest ¶
func (c *AuthorizeRequest) HandleRequest(r *http.Request) (*AuthorizeData, error)
Handle the authorization request
type AuthorizeRequestType ¶
type AuthorizeRequestType string
const (
CODE AuthorizeRequestType = "code"
)
type Client ¶
type Client struct { // Transport is the HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper // contains filtered or unexported fields }
func (*Client) NewAccessRequest ¶
func (c *Client) NewAccessRequest(t AccessRequestType, ad *AuthorizeData) *AccessRequest
func (*Client) NewAuthorizeRequest ¶
func (c *Client) NewAuthorizeRequest(t AuthorizeRequestType) *AuthorizeRequest
Creates a new authorize request
func (*Client) NewCustomRequest ¶
func (c *Client) NewCustomRequest() *CustomRequest
type ClientConfig ¶
type ClientConfig struct { ClientId string ClientSecret string AuthorizeUrl string TokenUrl string RedirectUrl string Scope string ErrorsInStatusCode bool SendClientSecretInParams bool UseGetAccessRequest bool // PKCE / RFC7636 fields CodeChallenge string CodeChallengeMethod string CodeVerifier string }
type CustomRequest ¶
type CustomRequest struct { CustomParameters map[string]string // contains filtered or unexported fields }
Custom request information
func (*CustomRequest) GetRequest ¶
func (c *CustomRequest) GetRequest(url *url.URL) (*CustomData, error)
Send a custom request On OAuth2 error, and osincli.Error is returned as error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.