Documentation
¶
Overview ¶
Package gateway implments various auth logic used across noebs services
Index ¶
- Constants
- Variables
- func GenerateAPIKey() (string, error)
- func GenerateSecretKey(n int) ([]byte, error)
- func Instrumentation() gin.HandlerFunc
- func NoebsCors(headers []string) func(c *gin.Context)
- func SyncLedger(user ebs_fields.User) error
- type Cards
- type ErrorResponse
- type GetRedisClient
- type JWT
- type JWTAuth
- type Service
- type Token
- type TokenClaims
Constants ¶
const (
BACKUP_TIME = 24 * time.Minute
)
Variables ¶
var (
ErrCreateDbRow = errors.New("unable to create a new db row/column")
)
Functions ¶
func GenerateAPIKey ¶
func GenerateSecretKey ¶
GenerateSecretKey generates secret key for jwt signing
func Instrumentation ¶
func Instrumentation() gin.HandlerFunc
func NoebsCors ¶ added in v0.3.0
NoebsCors reads from noebs config to setup cors headers for the server
func SyncLedger ¶ added in v1.1.2
func SyncLedger(user ebs_fields.User) error
SyncLedger sends the user data to the server endpoint (dapi.noebs.sd) for backup
Types ¶
type ErrorResponse ¶
type GetRedisClient ¶
type JWTAuth ¶
type JWTAuth struct {
Key []byte
NoebsConfig ebs_fields.NoebsConfig
}
JWTAuth provides an encapsulation for jwt auth
func (*JWTAuth) AuthMiddleware ¶
func (a *JWTAuth) AuthMiddleware() gin.HandlerFunc
AuthMiddleware is a JWT authorization middleware. It is used in our consumer services to get a username from the payload (maybe change it to mobile number at somepoint)
func (*JWTAuth) GenerateJWT ¶
GenerateJWT generates a JWT standard token with default values hardcoded. FIXME
type Token ¶
type Token struct {
JWT string `json:"authorization"`
Signature string `json:"signature"`
Message string `json:"message"`
Mobile string `json:"mobile" binding:"required,len=10"`
}
Token used by noebs client to refresh an existing token, that is Token.JWT Signature is the signed Message (it could be a mobile username, or totp code) and Message is the raw message (it could be a mobile username, or totp code)
type TokenClaims ¶
type TokenClaims struct {
Mobile string `json:"mobile"`
jwt.StandardClaims
}
TokenClaims noebs standard claim