handler

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractToken added in v1.4.0

func ExtractToken(r *http.Request) string

ExtractToken extracts the JWT token from the header.

func MakeProjectHandlers

func MakeProjectHandlers(r *mux.Router, service project.UseCase)

MakeProjectHandlers make url handlers for creating, updating, deleting, and getting projects

func TokenValid added in v1.4.0

func TokenValid(r *http.Request) error

TokenValid checks if a JWT token is valid.

func VerifyToken added in v1.4.0

func VerifyToken(r *http.Request) (*jwt.Token, error)

VerifyToken verifies the JWT token to ensure the public key was provided and it was signed via RSA.

Types

type AccessDetails added in v1.4.0

type AccessDetails struct {
	UserId string
}

func ExtractTokenMetadata added in v1.4.0

func ExtractTokenMetadata(r *http.Request) (*AccessDetails, error)

ExtractTokenMetadata extracts the data contained within the JWT token and returns an AccessDetails object.

type RequestBody added in v1.1.0

type RequestBody struct {
	ShortCode   string `json:"shortCode"`
	ShortName   string `json:"shortName"`
	LongName    string `json:"longName"`
	Description string `json:"description"`
}

RequestBody provides a reusable struct to use when decoding the JSON request body.

Jump to

Keyboard shortcuts

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