Documentation ¶
Index ¶
- func NewHTTPError(err error) *echo.HTTPError
- func NewHTTPErrorHandler(ctx echo.Context, err ErrorHandler) *echo.HTTPError
- type APIAudit
- type CreateFact
- type CreateGrant
- type CreateScope
- type ErrorHandler
- type Fact
- type GetFactSearch
- type Grant
- type GrantToken
- type Healthz
- type QueryAPIAudit
- type Scope
- type SearchFact
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPError ¶
func NewHTTPError(err error) *echo.HTTPError
NewHTTPError creates a new echo.HTTPError from the given error We make sure the messages in the response body is sanitized without leaking sensitive information
func NewHTTPErrorHandler ¶
func NewHTTPErrorHandler(ctx echo.Context, err ErrorHandler) *echo.HTTPError
Types ¶
type APIAudit ¶
type APIAudit struct { CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` Plane string `json:"plane,omitempty"` Domain string `json:"domain,omitempty"` HTTPPath string `json:"http_path,omitempty"` HTTPMethod string `json:"http_method,omitempty"` SentHTTPStatus int `json:"sent_http_status,omitempty"` }
APIAudit is the response apimodel
type CreateFact ¶
type CreateFact struct { ScopeCustomID string `json:"scope_custom_id"` Collection string `json:"collection" validate:"required"` Key string `json:"key"` Value string `json:"value" validate:"required"` }
CreateFact represents the request to create a fact
type CreateGrant ¶
type CreateGrant struct { Domain string `json:"domain" validate:"fqdn"` AllowedHTTPMethods []string `json:"allowed_http_methods" validate:"gt=0,dive,oneof=* GET POST PUT DELETE"` // Paths represent the path the grant token can access // We leverage KeyMatch2 to define paths https://github.com/casbin/casbin/blob/v2.25.5/util/builtin_operators_test.go#L88-L117 // By default if "paths" is not set, by default it's "*". For example, // // * // /api/v1/facts // /api/v1/facts/:id // /api/v1/* // /js/v1/facts // Paths []string `json:"paths"` }
CreateGrant represents the request object of creating a grant
type CreateScope ¶
type CreateScope struct {
CustomID string `json:"type"`
}
CreateScope represents the request of creating a scope
type ErrorHandler ¶
type Fact ¶
type Fact struct { ID string `json:"id"` ScopeCustomID string `json:"scope_custom_id,omitempty"` Domain string `json:"domain"` Value string `json:"value,omitempty"` }
Fact represents a fact
type GetFactSearch ¶
type Grant ¶
type Grant struct { Token string `json:"token"` Domain string `json:"domain"` AllowedHTTPMethods []string `json:"allowed_http_methods"` Paths []string `json:"paths,omitempty"` }
Grant represents the grant object
type GrantToken ¶
GrantToken represents a secret token
func NewToken ¶
func NewToken(version string, domain string) (*GrantToken, error)
NewToken creates a new Token
func (*GrantToken) Hash ¶
func (t *GrantToken) Hash(h crypto.Hasher) string
Hash uses HashFaster to hash the grant
func (*GrantToken) ParseFromString ¶
func (t *GrantToken) ParseFromString(s string) error
ParseFromString creates a new Token from its plaintext string
func (*GrantToken) String ¶
func (t *GrantToken) String() string
String returns the plaintext encoding of the Token
type Healthz ¶
type Healthz struct {
Status string `json:"status"`
}
Healthz represents the health check response struct
type QueryAPIAudit ¶
type QueryAPIAudit struct { Domain *string `query:"domain"` Plane *string `query:"plane"` HTTPPath *string `query:"http_path"` HTTPMethod *string `query:"http_method"` SentHTTPStatus *int `query:"sent_http_status"` Limit *int `query:"limit"` Offset *int `query:"offset"` OrderBy *string `query:"order_by"` OrderDesc bool `query:"order_desc"` }
QueryAPIAudit is the query struct