Documentation
¶
Index ¶
- Constants
- Variables
- func Check(params *WarrantCheckParams) (bool, error)
- func CheckHasFeature(params *FeatureCheckParams) (bool, error)
- func CheckMany(params *WarrantCheckManyParams) (bool, error)
- func CheckUserHasPermission(params *PermissionCheckParams) (bool, error)
- func CheckUserHasRole(params *RoleCheckParams) (bool, error)
- func Delete(params *WarrantParams) error
- func HasValidSession(params *VerifySessionParams) (bool, error)
- type AccessCheckRequest
- type AuthorizationSessionParams
- type Client
- func (c Client) Check(params *WarrantCheckParams) (bool, error)
- func (c Client) CheckHasFeature(params *FeatureCheckParams) (bool, error)
- func (c Client) CheckMany(params *WarrantCheckManyParams) (bool, error)
- func (c Client) CheckUserHasPermission(params *PermissionCheckParams) (bool, error)
- func (c Client) CheckUserHasRole(params *RoleCheckParams) (bool, error)
- func (c Client) Create(params *WarrantParams) (*Warrant, error)
- func (c Client) Delete(params *WarrantParams) error
- func (c Client) HasValidSession(params *VerifySessionParams) (bool, error)
- func (c Client) Query(queryString string, listParams *ListWarrantParams) (*QueryWarrantResult, error)
- type Context
- type EnsureHasPermission
- type EnsureHasPermissionOptions
- type EnsureIsAuthorized
- type EnsureIsAuthorizedOptions
- type Feature
- type FeatureCheckParams
- type FeatureParams
- type GetObjectIdFunc
- type GetUserIdFunc
- type ListFeatureParams
- type ListParams
- type ListPermissionParams
- type ListPricingTierParams
- type ListRoleParams
- type ListTenantParams
- type ListUserParams
- type ListWarrantParams
- type Middleware
- type MiddlewareConfig
- type NewEnsureHasPermissionFunc
- type NewEnsureIsAuthorizedFunc
- type Object
- type Permission
- type PermissionCheckParams
- type PermissionParams
- type PricingTier
- type PricingTierParams
- type QueryWarrantResult
- type Role
- type RoleCheckParams
- type RoleParams
- type SelfServiceSessionParams
- type Session
- type Subject
- type Tenant
- type TenantParams
- type User
- type UserParams
- type VerifySessionParams
- type VerifySessionResponse
- type Warrant
- type WarrantCheck
- type WarrantCheckManyParams
- type WarrantCheckParams
- type WarrantCheckResult
- type WarrantObject
- type WarrantParams
Constants ¶
View Source
const ( SelfServiceStrategyFGAC = "fgac" SelfServiceStrategyRBAC = "rbac" )
View Source
const ObjectTypeFeature = "feature"
View Source
const ObjectTypePermission = "permission"
View Source
const ObjectTypePricingTier = "pricing-tier"
View Source
const ObjectTypeRole = "role"
View Source
const ObjectTypeTenant = "tenant"
View Source
const ObjectTypeUser = "user"
Variables ¶
View Source
var ApiEndpoint string = "https://api.warrant.dev"
View Source
var ApiKey string
View Source
var AuthorizeEndpoint string = "https://api.warrant.dev"
View Source
var SelfServiceDashEndpoint string = "https://self-serve.warrant.dev"
Functions ¶
func Check ¶
func Check(params *WarrantCheckParams) (bool, error)
func CheckHasFeature ¶
func CheckHasFeature(params *FeatureCheckParams) (bool, error)
func CheckMany ¶
func CheckMany(params *WarrantCheckManyParams) (bool, error)
func CheckUserHasPermission ¶
func CheckUserHasPermission(params *PermissionCheckParams) (bool, error)
func CheckUserHasRole ¶
func CheckUserHasRole(params *RoleCheckParams) (bool, error)
func Delete ¶
func Delete(params *WarrantParams) error
func HasValidSession ¶
func HasValidSession(params *VerifySessionParams) (bool, error)
Types ¶
type AccessCheckRequest ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config config.ClientConfig) Client
func (Client) CheckHasFeature ¶
func (c Client) CheckHasFeature(params *FeatureCheckParams) (bool, error)
func (Client) CheckUserHasPermission ¶
func (c Client) CheckUserHasPermission(params *PermissionCheckParams) (bool, error)
func (Client) CheckUserHasRole ¶
func (c Client) CheckUserHasRole(params *RoleCheckParams) (bool, error)
func (Client) Delete ¶
func (c Client) Delete(params *WarrantParams) error
func (Client) HasValidSession ¶
func (c Client) HasValidSession(params *VerifySessionParams) (bool, error)
func (Client) Query ¶
func (c Client) Query(queryString string, listParams *ListWarrantParams) (*QueryWarrantResult, error)
type EnsureHasPermission ¶
type EnsureHasPermission struct {
// contains filtered or unexported fields
}
func (*EnsureHasPermission) ServeHTTP ¶
func (ehp *EnsureHasPermission) ServeHTTP(w http.ResponseWriter, r *http.Request)
type EnsureIsAuthorized ¶
type EnsureIsAuthorized struct {
// contains filtered or unexported fields
}
func (*EnsureIsAuthorized) ServeHTTP ¶
func (eia *EnsureIsAuthorized) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Feature ¶
type Feature struct {
FeatureId string `json:"featureId"`
}
func (Feature) GetObjectId ¶
func (Feature) GetObjectType ¶
type FeatureCheckParams ¶
type FeatureParams ¶
type FeatureParams struct {
FeatureId string `json:"featureId"`
}
type GetObjectIdFunc ¶
type GetUserIdFunc ¶
type ListFeatureParams ¶
type ListFeatureParams struct {
ListParams
}
type ListParams ¶
type ListPermissionParams ¶
type ListPermissionParams struct {
ListParams
}
type ListPricingTierParams ¶
type ListPricingTierParams struct {
ListParams
}
type ListRoleParams ¶
type ListRoleParams struct {
ListParams
}
type ListTenantParams ¶
type ListTenantParams struct {
ListParams
}
type ListUserParams ¶
type ListUserParams struct {
ListParams
}
type ListWarrantParams ¶
type ListWarrantParams struct {
ListParams
}
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(middlewareConfig MiddlewareConfig) *Middleware
func (Middleware) NewEnsureHasPermission ¶
func (mw Middleware) NewEnsureHasPermission(handler http.Handler, options EnsureHasPermissionOptions) *EnsureHasPermission
func (Middleware) NewEnsureIsAuthorized ¶
func (mw Middleware) NewEnsureIsAuthorized(handler http.Handler, options EnsureIsAuthorizedOptions) *EnsureIsAuthorized
type MiddlewareConfig ¶
type MiddlewareConfig struct {
ApiKey string
GetObjectId GetObjectIdFunc
GetUserId GetUserIdFunc
OnAccessDenied http.HandlerFunc
}
type NewEnsureHasPermissionFunc ¶
type NewEnsureHasPermissionFunc func(handler http.Handler, options EnsureHasPermissionOptions) *EnsureHasPermission
type NewEnsureIsAuthorizedFunc ¶
type NewEnsureIsAuthorizedFunc func(handler http.Handler, options EnsureIsAuthorizedOptions) *EnsureIsAuthorized
type Permission ¶
type Permission struct {
PermissionId string `json:"permissionId"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
}
func (Permission) GetObjectId ¶
func (permission Permission) GetObjectId() string
func (Permission) GetObjectType ¶
func (permission Permission) GetObjectType() string
type PermissionCheckParams ¶
type PermissionParams ¶
type PricingTier ¶
type PricingTier struct {
PricingTierId string `json:"pricingTierId"`
}
func (PricingTier) GetObjectId ¶
func (pricingTier PricingTier) GetObjectId() string
func (PricingTier) GetObjectType ¶
func (pricingTier PricingTier) GetObjectType() string
type PricingTierParams ¶
type PricingTierParams struct {
PricingTierId string `json:"pricingTierId"`
}
type QueryWarrantResult ¶
type QueryWarrantResult struct {
Result interface{} `json:"result"`
Meta map[string]interface{} `json:"meta"`
}
func Query ¶
func Query(queryString string, params *ListWarrantParams) (*QueryWarrantResult, error)
type Role ¶
type Role struct {
RoleId string `json:"roleId"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
}
func (Role) GetObjectId ¶
func (Role) GetObjectType ¶
type RoleCheckParams ¶
type RoleParams ¶
type SelfServiceSessionParams ¶
type SelfServiceSessionParams struct {
UserId string `json:"userId"`
TenantId string `json:"tenantId"`
TTL int64 `json:"ttl,omitempty"`
SelfServiceStrategy string `json:"selfServiceStrategy"`
ObjectType string `json:"objectType"`
ObjectId string `json:"objectId"`
RedirectUrl string `json:"redirectUrl"`
}
type Subject ¶
type Subject struct {
ObjectType string `json:"objectType"`
ObjectId string `json:"objectId"`
Relation string `json:"relation,omitempty"`
}
func (Subject) GetObjectId ¶
func (Subject) GetObjectType ¶
type Tenant ¶
type Tenant struct {
TenantId string `json:"tenantId"`
Name string `json:"name,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
func (Tenant) GetObjectId ¶
func (Tenant) GetObjectType ¶
type TenantParams ¶
type UserParams ¶
type VerifySessionParams ¶
type VerifySessionParams struct {
SessionId string `json:"sessionId"`
}
type VerifySessionResponse ¶
type Warrant ¶
type Warrant struct {
ObjectType string `json:"objectType"`
ObjectId string `json:"objectId"`
Relation string `json:"relation"`
Subject Subject `json:"subject"`
Context Context `json:"context,omitempty"`
IsImplicit bool `json:"isImplicit,omitempty"`
}
func Create ¶
func Create(params *WarrantParams) (*Warrant, error)
type WarrantCheck ¶
type WarrantCheck struct {
Object WarrantObject `json:"object"`
Relation string `json:"relation"`
Subject WarrantObject `json:"subject"`
Context Context `json:"context,omitempty"`
}
func (WarrantCheck) ToWarrant ¶
func (warrantCheck WarrantCheck) ToWarrant() Warrant
type WarrantCheckManyParams ¶
type WarrantCheckManyParams struct {
Op string `json:"op"`
Warrants []WarrantCheck `json:"warrants"`
ConsistentRead bool `json:"consistentRead,omitempty"`
Debug bool `json:"debug,omitempty"`
}
type WarrantCheckParams ¶
type WarrantCheckParams struct {
WarrantCheck WarrantCheck `json:"warrantCheck"`
ConsistentRead bool `json:"consistentRead,omitempty"`
Debug bool `json:"debug,omitempty"`
}
type WarrantCheckResult ¶
type WarrantObject ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.