gateway

package
v0.0.0-...-dcf5b65 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalServerError = newError(http.StatusInternalServerError)
	ErrUnauthorized        = newError(http.StatusUnauthorized)
	ErrForbidden           = newError(http.StatusForbidden)
)

Functions

func ErrorResponse

func ErrorResponse(err *Error, w http.ResponseWriter)

func JSONResponse

func JSONResponse(w http.ResponseWriter, status int, payload interface{})

Types

type Error

type Error struct {
	HTTPStatus int    `json:"http_status"`
	Message    string `json:"message"`
}

type Server

type Server struct {
	*configs.Config
	SessionManager *session.Manager
	CookieManager  *securecookie.SecureCookie
	Router         *mux.Router
	CSRFManager    *csrf.Manager
	Store          *storemanager.Store
}

Server encapsulates the connection objects and configs for the gateway server

func NewServer

func NewServer() *Server

NewServer returns an instance of server

func (*Server) AuthCallback

func (s *Server) AuthCallback(w http.ResponseWriter, r *http.Request)

func (*Server) AuthRedirect

func (s *Server) AuthRedirect(w http.ResponseWriter, r *http.Request)

func (*Server) CreateUser

func (s *Server) CreateUser(w http.ResponseWriter, r *http.Request)

func (*Server) GetGraphqlSchema

func (s *Server) GetGraphqlSchema() (*graphql.Schema, error)

func (*Server) GetOAuth2Config

func (s *Server) GetOAuth2Config() *oauth2.Config

func (*Server) HandleSession

func (s *Server) HandleSession(next http.Handler) http.Handler

HandleSession checks session data

func (*Server) Init

func (s *Server) Init() error

Init will initialise configs, connections etc.

func (*Server) InitRoutes

func (s *Server) InitRoutes() error

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) SessionHandler

func (s *Server) SessionHandler() http.Handler

func (*Server) UpdateProfileReputation

func (s *Server) UpdateProfileReputation(user *usersstore.User, sessionID string)

type UserRequest

type UserRequest struct {
	Name        *string `json:"name"`
	AccessToken *string `json:"access_token"`
	Handle      *string `json:"handle"`
}

Directories

Path Synopsis
Code generated by github.com/gokultp/go-envparser.
Code generated by github.com/gokultp/go-envparser.
models

Jump to

Keyboard shortcuts

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