server

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthenticated

func IsAuthenticated(next echo.HandlerFunc) echo.HandlerFunc

IsAuthenticated is a middleware that checks if the user has already been authenticated previously.

Types

type Authenticator

type Authenticator struct {
	*oidc.Provider
	oauth2.Config
}

Authenticator is used to authenticate our users. Refereance link - https://auth0.com/docs/quickstart/webapp/golang/01-login for sample auth setup.

func (*Authenticator) VerifyIDToken

func (a *Authenticator) VerifyIDToken(ctx context.Context, token *oauth2.Token) (*oidc.IDToken, error)

VerifyIDToken verifies that an *oauth2.Token is a valid *oidc.IDToken.

type Config

type Config struct {
	Port             int
	AuthDomain       string
	AuthClientID     string
	AuthClientSecret string
	AuthCallbackURL  string
	SessionsSecret   string
}

type Server

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

func New

func New(logger *zap.Logger, db database.DB, conf Config) (*Server, error)

func (*Server) CreateOrganization

func (s *Server) CreateOrganization(ctx echo.Context) error

(POST /organizations)

func (*Server) CreateProject

func (s *Server) CreateProject(ctx echo.Context, organization string) error

(POST /v1/organizations/{organization}/projects)

func (*Server) DeleteOrganization

func (s *Server) DeleteOrganization(ctx echo.Context, name string) error

(DELETE /organizations/{name})

func (*Server) DeleteProject

func (s *Server) DeleteProject(ctx echo.Context, organization, name string) error

(DELETE /v1/organizations/{organization}/project/{name})

func (*Server) FindOrganization

func (s *Server) FindOrganization(ctx echo.Context, name string) error

(GET /organizations/{name})

func (*Server) FindOrganizations

func (s *Server) FindOrganizations(ctx echo.Context) error

(GET /v1/organizations)

func (*Server) FindProject

func (s *Server) FindProject(ctx echo.Context, organization, name string) error

(GET /v1/organizations/{organization}/project/{name})

func (*Server) FindProjects

func (s *Server) FindProjects(ctx echo.Context, organization string) error

(GET /v1/organizations/{organization}/projects)

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, port int) error

func (*Server) UpdateOrganization

func (s *Server) UpdateOrganization(ctx echo.Context, name string) error

(PUT /organizations/{name})

func (*Server) UpdateProject

func (s *Server) UpdateProject(ctx echo.Context, organization, name string) error

(PUT /v1/organizations/{organization}/project/{name})

Jump to

Keyboard shortcuts

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