Documentation ¶
Index ¶
- func MustQueryString(d interface{}) string
- func QueryString(d interface{}) (queryString string, err error)
- type AccessTokenRequest
- type AuthorizationRequest
- type AuthorizationResponse
- type ErrorCode
- type ErrorResponse
- type GrantType
- type Responder
- func (r Responder) ErrInvalidClientBasicAuthorization(realmName string, errorDesc string)
- func (r Responder) Error(errorData ErrorResponse)
- func (r Responder) ErrorCode(errorCode ErrorCode)
- func (r Responder) ErrorWithHTTPStatusCode(errorData ErrorResponse, httpStatusCode int)
- func (r Responder) TokenCustom(tokenData interface{})
- type ResponseType
- type TokenResponse
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustQueryString ¶
func MustQueryString(d interface{}) string
func QueryString ¶
Types ¶
type AccessTokenRequest ¶
type AuthorizationRequest ¶
type AuthorizationRequest struct { ResponseType string `schema:"response_type"` ClientID string `schema:"client_id"` RedirectURI string `schema:"redirect_uri,omitempty"` Scope string `schema:"scope,omitepmty"` State string `schema:"state,omitempty"` }
func AuthorizationRequestFromURLValues ¶
func AuthorizationRequestFromURLValues(values url.Values) (*AuthorizationRequest, error)
type AuthorizationResponse ¶
type ErrorCode ¶
type ErrorCode string
const ( // 4.1.2.1, 4.2.2.1, 5.2 ErrorInvalidRequest ErrorCode = "invalid_request" ErrorUnauthorizedClient ErrorCode = "unauthorized_client" // 4.1.2.1, 4.2.2.1 ErrorAccessDenied ErrorCode = "access_denied" // 4.1.2.1, 4.2.2.1 ErrorUnspportedResponseType ErrorCode = "unsupported_response_type" // 4.1.2.1, 4.2.2.1, 5.2 ErrorInvalidScope ErrorCode = "invalid_scope" // 4.1.2.1, 4.2.2.1 ErrorServerError ErrorCode = "server_error" ErrorTemporarilyUnavailable ErrorCode = "temporarily_unavailable" // 5.2 ErrorInvalidClient ErrorCode = "invalid_client" // 5.2 ErrorInvalidGrant ErrorCode = "invalid_grant" // 5.2 ErrorUnsupportedGrantType ErrorCode = "unsupported_grant_type" )
func (ErrorCode) HTTPStatusCode ¶
type ErrorResponse ¶
type ErrorResponse struct { Error ErrorCode `json:"error" schema:"error"` ErrorDescription string `json:"error_description,omitempty" schema:"error_description,omitempty"` ErrorURI string `json:"error_uri,omitempty" schema:"error_uri,omitempty"` State string `json:"-" schema:"state,omitempty"` }
func (ErrorResponse) SwaggerDoc ¶
func (ErrorResponse) SwaggerDoc() map[string]string
type Responder ¶
type Responder struct {
// contains filtered or unexported fields
}
func RespondTo ¶
func RespondTo(w http.ResponseWriter) Responder
func (Responder) ErrInvalidClientBasicAuthorization ¶
ErrInvalidClientBasicAuthorization is used for special case for ErrorInvalidClient. Instead of returning 400, we respond with 401 and provide information about the client authorizations supported, for this case, Basic.
Details: RFC 6749 § 5.2
func (Responder) Error ¶
func (r Responder) Error(errorData ErrorResponse)
func (Responder) ErrorWithHTTPStatusCode ¶
func (r Responder) ErrorWithHTTPStatusCode(errorData ErrorResponse, httpStatusCode int)
func (Responder) TokenCustom ¶
func (r Responder) TokenCustom(tokenData interface{})
type ResponseType ¶
type ResponseType string
const ( ResponseTypeCode ResponseType = "code" ResponseTypeToken ResponseType = "token" ResponseTypeUnknown ResponseType = "" )
func ResponseTypeFromString ¶
func ResponseTypeFromString(s string) ResponseType
func (ResponseType) String ¶
func (responseType ResponseType) String() string
type TokenResponse ¶
type TokenResponse struct { // The access token issued by the authorization server. AccessToken string `json:"access_token" schema:"access_token"` // The type of the token issued as described in // Section 7.1. Value is case insensitive. TokenType TokenType `json:"token_type" schema:"token_type"` // The lifetime in seconds of the access token. For // example, the value "3600" denotes that the access token will // expire in one hour from the time the response was generated. // If omitted, the authorization server SHOULD provide the // expiration time via other means or document the default value. ExpiresIn int64 `json:"expires_in,omitempty" schema:"expires_in,omitempty"` // The refresh token, which can be used to obtain new // access tokens using the same authorization grant as described // in Section 6. RefreshToken string `json:"refresh_token,omitempty" schema:"refresh_token,omitempty"` // The scope of the access token as described by Section 3.3. Scope string `json:"scope,omitempty" schema:"scope,omitempty"` State string `json:"-" schema:"state,omitempty"` }
TokenResponse is used on successful authorization. The authorization server issues an access token and optional refresh token, and constructs the response by adding the following parameters to the entity-body of the HTTP response with a 200 (OK) status code
func (TokenResponse) SwaggerDoc ¶
func (TokenResponse) SwaggerDoc() map[string]string
Click to show internal directories.
Click to hide internal directories.