Documentation ¶
Index ¶
- Variables
- func DecodeJSONBody(r *http.Request, data any) error
- func GenerateLoginJwtString(loginJwtFields LoginJwtFields) (string, error)
- func GetDB() (db *gorm.DB, err error)
- func GetOauthAccessToken(code string) (string, error)
- func LogErr(r *http.Request, err error, errMsg string)
- func LogErrAndRespond(r *http.Request, w http.ResponseWriter, err error, errMsg string, ...)
- func LogInfo(r *http.Request, info string)
- func LogWarn(r *http.Request, warning string)
- func LogWarnAndRespond(r *http.Request, w http.ResponseWriter, warning string, statusCode int)
- func MigrateModels(db *gorm.DB) error
- func RespondWithHTTPMessage(r *http.Request, w http.ResponseWriter, status int, message string)
- func RespondWithJson(r *http.Request, w http.ResponseWriter, response any)
- type GHUserInfo
- type HTTPMessage
- type LoginJwtClaims
- type LoginJwtFields
- type OAuthAccessReqFields
- type OAuthAccessResFields
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClientIdNotFound = errors.New("ERROR: GITHUB OAUTH CLIENT ID NOT FOUND")
View Source
var ErrClientSecretNotFound = errors.New("ERROR: GITHUB OAUTH CLIENT SECRET NOT FOUND")
View Source
var ErrGithubAPIError = errors.New("ERROR: GITHUB API ERROR")
View Source
var ErrJwtSecretKeyNotFound = errors.New("ERROR: JWT SECRET KEY NOT FOUND")
View Source
var ErrJwtTokenInvalid = errors.New("ERROR: JWT TOKEN INVALID")
Functions ¶
func GenerateLoginJwtString ¶
func GenerateLoginJwtString(loginJwtFields LoginJwtFields) (string, error)
func GetOauthAccessToken ¶
func LogErrAndRespond ¶
func LogWarnAndRespond ¶
func RespondWithHTTPMessage ¶ added in v2.0.1
func RespondWithJson ¶
func RespondWithJson(r *http.Request, w http.ResponseWriter, response any)
Types ¶
type GHUserInfo ¶
type GHUserInfo struct { Username string `json:"login"` Name string `json:"name"` Email string `json:"email"` }
func GetOauthUserInfo ¶
func GetOauthUserInfo(accessToken string) (*GHUserInfo, error)
type HTTPMessage ¶ added in v2.0.1
type LoginJwtClaims ¶
type LoginJwtClaims struct { LoginJwtFields jwt.RegisteredClaims }
func ParseLoginJwtString ¶
func ParseLoginJwtString(tokenString string) (*jwt.Token, *LoginJwtClaims, error)
type LoginJwtFields ¶
type LoginJwtFields struct {
Username string `json:"username"`
}
type OAuthAccessReqFields ¶
type OAuthAccessReqFields struct { ClientId string `json:"client_id"` ClientSecret string `json:"client_secret"` Code string `json:"code"` }
Body fields for the request
type OAuthAccessResFields ¶
type OAuthAccessResFields struct { AccessToken string `json:"access_token"` Error string `json:"error"` }
Body fields for the response
Click to show internal directories.
Click to hide internal directories.