rest

package
v0.0.0-...-35a8602 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AcceptedContentTypes = []string{"application/json", "application/x-www-form-urlencoded"}

AcceptedContentTypes is a list of all the accepted content types

Functions

func AuthMiddleware

func AuthMiddleware() gin.HandlerFunc

AuthMiddleware is a gin middleware that checks if the request is authorized and authenticated

func ExtractBearerToken

func ExtractBearerToken(r *gin.Context) (string, error)

ExtractBearerToken gets a bearer token from an Authorization header.

This is expected to contain a Firebase idToken prefixed with "Bearer "

func ExtractToken

func ExtractToken(c *gin.Context, header string, prefix string) (string, error)

ExtractToken extracts a token with the specified prefix from the specified header

func HasValidFirebaseBearerToken

func HasValidFirebaseBearerToken(c *gin.Context) (bool, map[string]string, string)

HasValidFirebaseBearerToken returns true with no errors if the request has a valid bearer token in the authorization header. Otherwise, it returns false and the error in a map with the key "error"

Types

type PresentationHandlers

type PresentationHandlers interface {
	HandleLoginByPhone() gin.HandlerFunc
	HandleRegistration() gin.HandlerFunc
	SetUserPIN() gin.HandlerFunc
	GetUserProfileByPhoneNumber() gin.HandlerFunc
}

PresentationHandlers represents all the REST API logic

func NewPresentationHandlers

func NewPresentationHandlers(usecases usecases.Makao) PresentationHandlers

NewPresentationHandlers initializes a new rest handlers usecase

type PresentationHandlersImpl

type PresentationHandlersImpl struct {
	// contains filtered or unexported fields
}

PresentationHandlersImpl represents the usecase implementation object

func (PresentationHandlersImpl) GetUserProfileByPhoneNumber

func (p PresentationHandlersImpl) GetUserProfileByPhoneNumber() gin.HandlerFunc

GetUserProfileByPhoneNumberuser search

func (PresentationHandlersImpl) HandleLoginByPhone

func (p PresentationHandlersImpl) HandleLoginByPhone() gin.HandlerFunc

HandleRegistration handles the user registration

func (PresentationHandlersImpl) HandleRegistration

func (p PresentationHandlersImpl) HandleRegistration() gin.HandlerFunc

HandleIncomingMessages handles and processes data posted by AIT to its callback URL

func (PresentationHandlersImpl) SetUserPIN

func (p PresentationHandlersImpl) SetUserPIN() gin.HandlerFunc

SetUserPIN handles the setting of the user PIN

Jump to

Keyboard shortcuts

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