server

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRSSItemCount = 100
View Source
const MaxRSSItemTitleLength = 100
View Source
const (
	MebiByte = 1024 * 1024
)

Variables

This section is empty.

Functions

func GenerateTokensAndSetCookies added in v0.12.0

func GenerateTokensAndSetCookies(c echo.Context, user *api.User, secret string) error

GenerateTokensAndSetCookies generates jwt token and saves it to the http-only cookie.

func JWTMiddleware added in v0.12.0

func JWTMiddleware(server *Server, next echo.HandlerFunc, secret string) echo.HandlerFunc

JWTMiddleware validates the access token. If the access token is about to expire or has expired and the request has a valid refresh token, it will try to generate new access token and refresh token.

func RemoveTokensAndCookies added in v0.12.0

func RemoveTokensAndCookies(c echo.Context)

RemoveTokensAndCookies removes the jwt token and refresh token from the cookies.

Types

type Claims added in v0.12.0

type Claims struct {
	Name string `json:"name"`
	jwt.RegisteredClaims
}

Claims creates a struct that will be encoded to a JWT. We add jwt.RegisteredClaims as an embedded type, to provide fields such as name.

type Server

type Server struct {
	ID      string
	Profile *profile.Profile
	Store   *store.Store
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error)

func (*Server) GetEcho added in v0.13.0

func (s *Server) GetEcho() *echo.Echo

func (*Server) Shutdown added in v0.10.3

func (s *Server) Shutdown(ctx context.Context)

func (*Server) Start added in v0.10.3

func (s *Server) Start(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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