handlers

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ConsentActionAccept = ConsentAction("accept")
	ConsentActionDeny   = ConsentAction("deny")
)

Variables

This section is empty.

Functions

func ErrFailedToGetAdmins

func ErrFailedToGetAdmins(err error) render.Renderer

func ErrFailedToSetInitialAdmin

func ErrFailedToSetInitialAdmin(err error) render.Renderer

func ErrInvalidRequest

func ErrInvalidRequest(err error) render.Renderer

Types

type AccountType

type AccountType string
const (
	TypeServiceAccount AccountType = "ServiceAccount"
	TypeUser           AccountType = "User"
)

type BootstrapRequest

type BootstrapRequest struct {
	UserID string `json:"userId,omitempty"`
}

func (*BootstrapRequest) Bind

func (b *BootstrapRequest) Bind(r *http.Request) error

func (*BootstrapRequest) Render

type ConsentAction added in v0.4.0

type ConsentAction string

type ConsentRequest added in v0.4.0

type ConsentRequest struct {
	Challenge  string        `json:"consent_challenge"`
	Action     ConsentAction `json:"consent_action"`
	Remember   bool          `json:"remember"`
	GrantScope []string      `json:"grant_scope"`
}

type ErrResponse

type ErrResponse struct {
	Err            error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

func (*ErrResponse) Render

func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error

type Handler

type Handler struct {
	C           *clients.ClientWrapper
	Log         logr.Logger
	Propagators propagation.TextMapPropagator
	// contains filtered or unexported fields
}

func (*Handler) BootstrapAdmin

func (h *Handler) BootstrapAdmin(w http.ResponseWriter, r *http.Request)

func (*Handler) BootstrapUser

func (h *Handler) BootstrapUser(b *BootstrapRequest) *BootstrapRequest

func (*Handler) Consent added in v0.4.0

func (h *Handler) Consent(w http.ResponseWriter, r *http.Request)

func (*Handler) GetHerodot

func (h *Handler) GetHerodot() *herodot.JSONWriter

func (*Handler) Middleware

func (h *Handler) Middleware() func(http.Handler) http.Handler

Middleware decodes the share session cookie and packs the session into context

func (*Handler) ObservabilityTenantPolicyCheck

func (h *Handler) ObservabilityTenantPolicyCheck(w http.ResponseWriter, r *http.Request)

type PolicyRequest

type PolicyRequest struct {
	Subject             string `json:"subject"`
	IsOAuth2Client      bool   `json:"isOAuth2Client"`
	RequestedPermission string `json:"requestedPermission"`
	// contains filtered or unexported fields
}

func (*PolicyRequest) GetRelationQuery

func (p *PolicyRequest) GetRelationQuery() *rts.RelationQuery

func (*PolicyRequest) GetRelationTuple

func (p *PolicyRequest) GetRelationTuple(tenantId string) *rts.RelationTuple

type User

type User struct {
	// Type          AccountType
	// Username      string
	Id    string
	Name  string
	Email string
	// Groups        []string
	// ProfileImage  *string
	// JWT           *string
	KratosSession *kratosClient.Session
	IsAdmin       bool
}

A stand-in for our backed user object

func ForContext

func ForContext(ctx context.Context) *User

ForContext finds the user from the context. REQUIRES Middleware to have run.

Jump to

Keyboard shortcuts

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