server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, store *store.Store, config *Config) (*chi.Mux, error)

Types

type Config

type Config struct {
	DevMode        bool
	RedirectURI    string
	RequestsEngine RequestsEngineConfig
}

func DefaultConfig

func DefaultConfig() Config

type ContextKey

type ContextKey string

ContextKey is used to store the auth context value in the request context

type Policy

type Policy struct {
	Name   string
	Type   PolicyType
	Module string
}

type PolicyEngine

type PolicyEngine struct {
	Policies map[PolicyType][]Policy
}

func NewPolicyEngine

func NewPolicyEngine() *PolicyEngine

func (PolicyEngine) EvaluateLoginRequest

func (pe PolicyEngine) EvaluateLoginRequest(userInfo UserInfo) (bool, error)

type PolicyType

type PolicyType string
const (
	LoginPolicyType  PolicyType = "login"
	AccessPolicyType PolicyType = "access"
)

type RequestsEngine

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

RequestsEngine is responsible for storing all the requests, validting incoming requets, and providing the frontend with request specs

func NewRequestsEngine

func NewRequestsEngine(config *RequestsEngineConfig) (*RequestsEngine, error)

func (*RequestsEngine) OpenAPISpec

func (e *RequestsEngine) OpenAPISpec() []byte

func (*RequestsEngine) Validate

func (e *RequestsEngine) Validate(input oapi.NewRequest) error

type RequestsEngineConfig

type RequestsEngineConfig struct {
	Module     string
	ModuleRoot string
}

func DefaultRequestsEngineConfig

func DefaultRequestsEngineConfig() RequestsEngineConfig

type ServerImpl

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

func (*ServerImpl) CreateProject

func (s *ServerImpl) CreateProject(w http.ResponseWriter, r *http.Request)

func (*ServerImpl) CreateRequest

func (s *ServerImpl) CreateRequest(w http.ResponseWriter, r *http.Request)

func (*ServerImpl) CreateService

func (s *ServerImpl) CreateService(w http.ResponseWriter, r *http.Request)

func (*ServerImpl) GetProjectByID

func (s *ServerImpl) GetProjectByID(w http.ResponseWriter, r *http.Request, id uuid.UUID)

func (*ServerImpl) GetProjects

func (s *ServerImpl) GetProjects(w http.ResponseWriter, r *http.Request, params oapi.GetProjectsParams)

func (*ServerImpl) GetRequestByID

func (s *ServerImpl) GetRequestByID(w http.ResponseWriter, r *http.Request, id uuid.UUID)

func (*ServerImpl) GetRequests

func (s *ServerImpl) GetRequests(w http.ResponseWriter, r *http.Request, params oapi.GetRequestsParams)

func (*ServerImpl) GetRequestsSpec

func (s *ServerImpl) GetRequestsSpec(w http.ResponseWriter, r *http.Request)

func (*ServerImpl) GetServiceByID

func (s *ServerImpl) GetServiceByID(w http.ResponseWriter, r *http.Request, id uuid.UUID)

func (*ServerImpl) GetServices

func (s *ServerImpl) GetServices(w http.ResponseWriter, r *http.Request, params oapi.GetServicesParams)

func (ServerImpl) GetUserInfo

func (s ServerImpl) GetUserInfo(w http.ResponseWriter, r *http.Request)

func (*ServerImpl) ReviewRequest

func (s *ServerImpl) ReviewRequest(w http.ResponseWriter, r *http.Request, id uuid.UUID)

type Session

type Session struct {
	ID      uuid.UUID
	IDToken *oidc.IDToken

	UserInfo UserInfo
}

type Sessioner

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

func (*Sessioner) AuthorizeSession

func (s *Sessioner) AuthorizeSession(r *http.Request) (*Session, error)

func (*Sessioner) EndSession

func (s *Sessioner) EndSession(r *http.Request) error

func (*Sessioner) NewSession

func (s *Sessioner) NewSession(w http.ResponseWriter, claims *UserClaims)

type UserClaims

type UserClaims struct {
	UserID string   `json:"sub"`
	Email  string   `json:"email"`
	Name   string   `json:"name"`
	Groups []string `json:"groups"`
}

type UserInfo

type UserInfo struct {
	Name   string   `json:"name"`
	Email  string   `json:"email"`
	Groups []string `json:"groups"`
}

Jump to

Keyboard shortcuts

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