api

package
v0.0.0-...-42c0c98 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearTokens

func ClearTokens(client *ent.Client, ctx context.Context)

ClearTokens Clears Old tokens from DB

func ForContext

func ForContext(ctx context.Context) (*ent.User, error)

ForContext finds the user from the context. REQUIRES Middleware to have run.

func ForContextIp

func ForContextIp(ctx *gin.Context) (string, error)

func Middleware

func Middleware(client *ent.Client) gin.HandlerFunc

Middleware decodes the share session cookie and packs the session into context

func ReturnError

func ReturnError(ctx *gin.Context, code int, message string, err error)

func ServiceMiddleware

func ServiceMiddleware(client *ent.Client) gin.HandlerFunc

func UnauthenticatedMiddleware

func UnauthenticatedMiddleware() gin.HandlerFunc

Types

type APIError

type APIError struct {
	Message string `json:"message"`
	Error   error  `json:"error"`
}

type CompsoleJWTClaims

type CompsoleJWTClaims struct {
	ApiKey   string
	IssuedAt int64
	jwt.StandardClaims
}

CompsoleJWTClaims Create a struct that will be encoded to a JWT.

type ServiceAccountHeader

type ServiceAccountHeader struct {
	Authorization *string `header:"Authorization" binding:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL