auth-api/pkgs/handlers/types.go

35 lines
868 B
Go
Raw Normal View History

2020-12-29 13:46:58 +01:00
package handlers
2021-01-02 11:56:24 +01:00
import (
2023-05-08 15:29:19 +02:00
"gitea.larvit.se/pwrpln/auth-api/pkgs/db"
"gitea.larvit.se/pwrpln/go_log"
jwt "github.com/dgrijalva/jwt-go"
2021-01-02 11:56:24 +01:00
)
// Claims is the JWT struct
type Claims struct {
AccountID string `json:"accountId"`
AccountFields map[string][]string `json:"accountFields"`
AccountName string `json:"accountName"`
jwt.StandardClaims
}
2021-01-02 11:56:24 +01:00
// Handlers is the overall struct for all http request handlers
type Handlers struct {
Db db.Db
JwtKey []byte
Log go_log.Log
2021-01-02 11:56:24 +01:00
}
2020-12-29 13:46:58 +01:00
// ResJSONError is an error field that is used in JSON error responses
type ResJSONError struct {
Error string `json:"error"`
Field string `json:"field,omitempty"`
}
// ResToken is a response used to return a valid token and valid renewalToken
type ResToken struct {
JWT string `json:"jwt"`
RenewalToken string `json:"renewalToken"`
}