mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-07 13:19:31 -06:00
Grand test fixup (#138)
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
This commit is contained in:
parent
329a5e8144
commit
98263a7de6
2677 changed files with 1090869 additions and 219 deletions
19
vendor/github.com/superseriousbusiness/oauth2/v4/errors/error.go
generated
vendored
Normal file
19
vendor/github.com/superseriousbusiness/oauth2/v4/errors/error.go
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package errors
|
||||
|
||||
import "errors"
|
||||
|
||||
// New returns an error that formats as the given text.
|
||||
var New = errors.New
|
||||
|
||||
// known errors
|
||||
var (
|
||||
ErrInvalidRedirectURI = errors.New("invalid redirect uri")
|
||||
ErrInvalidAuthorizeCode = errors.New("invalid authorize code")
|
||||
ErrInvalidAccessToken = errors.New("invalid access token")
|
||||
ErrInvalidRefreshToken = errors.New("invalid refresh token")
|
||||
ErrExpiredAccessToken = errors.New("expired access token")
|
||||
ErrExpiredRefreshToken = errors.New("expired refresh token")
|
||||
ErrMissingCodeVerifier = errors.New("missing code verifier")
|
||||
ErrMissingCodeChallenge = errors.New("missing code challenge")
|
||||
ErrInvalidCodeChallenge = errors.New("invalid code challenge")
|
||||
)
|
||||
84
vendor/github.com/superseriousbusiness/oauth2/v4/errors/response.go
generated
vendored
Normal file
84
vendor/github.com/superseriousbusiness/oauth2/v4/errors/response.go
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Response error response
|
||||
type Response struct {
|
||||
Error error
|
||||
ErrorCode int
|
||||
Description string
|
||||
URI string
|
||||
StatusCode int
|
||||
Header http.Header
|
||||
}
|
||||
|
||||
// NewResponse create the response pointer
|
||||
func NewResponse(err error, statusCode int) *Response {
|
||||
return &Response{
|
||||
Error: err,
|
||||
StatusCode: statusCode,
|
||||
}
|
||||
}
|
||||
|
||||
// SetHeader sets the header entries associated with key to
|
||||
// the single element value.
|
||||
func (r *Response) SetHeader(key, value string) {
|
||||
if r.Header == nil {
|
||||
r.Header = make(http.Header)
|
||||
}
|
||||
r.Header.Set(key, value)
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc6749#section-5.2
|
||||
var (
|
||||
ErrInvalidRequest = errors.New("invalid_request")
|
||||
ErrUnauthorizedClient = errors.New("unauthorized_client")
|
||||
ErrAccessDenied = errors.New("access_denied")
|
||||
ErrUnsupportedResponseType = errors.New("unsupported_response_type")
|
||||
ErrInvalidScope = errors.New("invalid_scope")
|
||||
ErrServerError = errors.New("server_error")
|
||||
ErrTemporarilyUnavailable = errors.New("temporarily_unavailable")
|
||||
ErrInvalidClient = errors.New("invalid_client")
|
||||
ErrInvalidGrant = errors.New("invalid_grant")
|
||||
ErrUnsupportedGrantType = errors.New("unsupported_grant_type")
|
||||
ErrCodeChallengeRquired = errors.New("invalid_request")
|
||||
ErrUnsupportedCodeChallengeMethod = errors.New("invalid_request")
|
||||
ErrInvalidCodeChallengeLen = errors.New("invalid_request")
|
||||
)
|
||||
|
||||
// Descriptions error description
|
||||
var Descriptions = map[error]string{
|
||||
ErrInvalidRequest: "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed",
|
||||
ErrUnauthorizedClient: "The client is not authorized to request an authorization code using this method",
|
||||
ErrAccessDenied: "The resource owner or authorization server denied the request",
|
||||
ErrUnsupportedResponseType: "The authorization server does not support obtaining an authorization code using this method",
|
||||
ErrInvalidScope: "The requested scope is invalid, unknown, or malformed",
|
||||
ErrServerError: "The authorization server encountered an unexpected condition that prevented it from fulfilling the request",
|
||||
ErrTemporarilyUnavailable: "The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server",
|
||||
ErrInvalidClient: "Client authentication failed",
|
||||
ErrInvalidGrant: "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client",
|
||||
ErrUnsupportedGrantType: "The authorization grant type is not supported by the authorization server",
|
||||
ErrCodeChallengeRquired: "PKCE is required. code_challenge is missing",
|
||||
ErrUnsupportedCodeChallengeMethod: "Selected code_challenge_method not supported",
|
||||
ErrInvalidCodeChallengeLen: "Code challenge length must be between 43 and 128 charachters long",
|
||||
}
|
||||
|
||||
// StatusCodes response error HTTP status code
|
||||
var StatusCodes = map[error]int{
|
||||
ErrInvalidRequest: 400,
|
||||
ErrUnauthorizedClient: 401,
|
||||
ErrAccessDenied: 403,
|
||||
ErrUnsupportedResponseType: 401,
|
||||
ErrInvalidScope: 400,
|
||||
ErrServerError: 500,
|
||||
ErrTemporarilyUnavailable: 503,
|
||||
ErrInvalidClient: 401,
|
||||
ErrInvalidGrant: 401,
|
||||
ErrUnsupportedGrantType: 401,
|
||||
ErrCodeChallengeRquired: 400,
|
||||
ErrUnsupportedCodeChallengeMethod: 400,
|
||||
ErrInvalidCodeChallengeLen: 400,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue