Documentation ¶
Index ¶
- Constants
- Variables
- func BatchDelete(params []WarrantParams) (string, error)
- 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) (string, error)
- type AccessCheckRequest
- type ApiClient
- type AuthorizationSessionParams
- type ClientConfig
- type EnsureHasPermission
- type EnsureHasPermissionOptions
- type EnsureIsAuthorized
- type EnsureIsAuthorizedOptions
- type Error
- type Feature
- type FeatureCheckParams
- type FeatureParams
- type GetObjectIdFunc
- type GetUserIdFunc
- type ListFeatureParams
- type ListObjectParams
- type ListObjectTypeParams
- type ListParams
- type ListPermissionParams
- type ListPricingTierParams
- type ListResponse
- type ListRoleParams
- type ListTenantParams
- type ListUserParams
- type ListWarrantParams
- type Middleware
- type MiddlewareConfig
- type NewEnsureHasPermissionFunc
- type NewEnsureIsAuthorizedFunc
- type Object
- type ObjectParams
- type ObjectType
- type ObjectTypeParams
- type Permission
- type PermissionCheckParams
- type PermissionParams
- type PolicyContext
- type PricingTier
- type PricingTierParams
- type QueryParams
- type QueryResponse
- type QueryResult
- type RequestOptions
- type Role
- type RoleCheckParams
- type RoleParams
- type SelfServiceSessionParams
- type Session
- type Subject
- type Tenant
- type TenantParams
- type User
- type UserParams
- type Warrant
- type WarrantCheck
- type WarrantCheckManyParams
- type WarrantCheckParams
- type WarrantCheckResult
- type WarrantClient
- func (c WarrantClient) BatchCreate(params []WarrantParams) ([]Warrant, error)
- func (c WarrantClient) BatchDelete(params []WarrantParams) (string, error)
- func (c WarrantClient) Check(params *WarrantCheckParams) (bool, error)
- func (c WarrantClient) CheckHasFeature(params *FeatureCheckParams) (bool, error)
- func (c WarrantClient) CheckMany(params *WarrantCheckManyParams) (bool, error)
- func (c WarrantClient) CheckUserHasPermission(params *PermissionCheckParams) (bool, error)
- func (c WarrantClient) CheckUserHasRole(params *RoleCheckParams) (bool, error)
- func (c WarrantClient) Create(params *WarrantParams) (*Warrant, error)
- func (c WarrantClient) Delete(params *WarrantParams) (string, error)
- func (c WarrantClient) ListWarrants(listParams *ListWarrantParams) (ListResponse[Warrant], error)
- func (c WarrantClient) Query(queryString string, params *QueryParams) (ListResponse[QueryResult], error)
- type WarrantObject
- type WarrantParams
Constants ¶
View Source
const ( SelfServiceStrategyFGAC = "fgac" SelfServiceStrategyRBAC = "rbac" )
View Source
const (
ClientVersion string = "6.1.1"
)
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 HttpClient *http.Client = http.DefaultClient
View Source
var SelfServiceDashEndpoint string = "https://self-serve.warrant.dev"
Functions ¶
func BatchDelete ¶
func BatchDelete(params []WarrantParams) (string, error)
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) (string, error)
Types ¶
type AccessCheckRequest ¶
type AccessCheckRequest struct { RequestOptions Op string `json:"op"` Warrants []WarrantCheck `json:"warrants"` Debug bool `json:"debug,omitempty"` }
type ApiClient ¶
type ApiClient struct { HttpClient *http.Client Config ClientConfig }
func NewApiClient ¶
func NewApiClient(config ClientConfig) *ApiClient
func (ApiClient) MakeRequest ¶
type AuthorizationSessionParams ¶
type AuthorizationSessionParams struct { UserId string `json:"userId,omitempty"` TenantId string `json:"tenantId,omitempty"` TTL int64 `json:"ttl,omitempty"` Context PolicyContext `json:"context,omitempty"` }
type ClientConfig ¶
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"` Meta map[string]interface{} `json:"meta,omitempty"` }
func (Feature) GetObjectId ¶
func (Feature) GetObjectType ¶
type FeatureCheckParams ¶
type FeatureCheckParams struct { RequestOptions FeatureId string `json:"featureId"` Subject Subject `json:"subject"` Context PolicyContext `json:"context,omitempty"` Debug bool `json:"debug,omitempty"` }
type FeatureParams ¶
type FeatureParams struct { RequestOptions FeatureId string `json:"featureId"` Meta map[string]interface{} `json:"meta,omitempty"` }
type GetObjectIdFunc ¶
type GetUserIdFunc ¶
type ListFeatureParams ¶
type ListFeatureParams struct {
ListParams
}
type ListObjectParams ¶
type ListObjectParams struct { ListParams ObjectType string `json:"objectType,omitempty" url:"objectType,omitempty"` Query string `json:"q,omitempty" url:"q,omitempty"` }
type ListObjectTypeParams ¶
type ListObjectTypeParams struct {
ListParams
}
type ListParams ¶
type ListParams struct { RequestOptions PrevCursor string `json:"prevCursor,omitempty" url:"prevCursor,omitempty"` NextCursor string `json:"nextCursor,omitempty" url:"nextCursor,omitempty"` SortBy string `json:"sortBy,omitempty" url:"sortBy,omitempty"` SortOrder string `json:"sortOrder,omitempty" url:"sortOrder,omitempty"` Limit int `json:"limit,omitempty" url:"limit,omitempty"` }
type ListPermissionParams ¶
type ListPermissionParams struct {
ListParams
}
type ListPricingTierParams ¶
type ListPricingTierParams struct {
ListParams
}
type ListResponse ¶
type ListResponse[T any] struct { Results []T `json:"results,omitempty"` PrevCursor string `json:"prevCursor,omitempty"` NextCursor string `json:"nextCursor,omitempty"` }
func ListWarrants ¶ added in v6.1.1
func ListWarrants(listParams *ListWarrantParams) (ListResponse[Warrant], error)
func Query ¶
func Query(queryString string, params *QueryParams) (ListResponse[QueryResult], error)
type ListRoleParams ¶
type ListRoleParams struct {
ListParams
}
type ListTenantParams ¶
type ListTenantParams struct {
ListParams
}
type ListUserParams ¶
type ListUserParams struct {
ListParams
}
type ListWarrantParams ¶
type ListWarrantParams struct { ListParams ObjectType string `json:"objectType,omitempty" url:"objectType,omitempty"` ObjectId string `json:"objectId,omitempty" url:"objectId,omitempty"` Relation string `json:"relation,omitempty" url:"relation,omitempty"` SubjectType string `json:"subjectType,omitempty" url:"subjectType,omitempty"` SubjectId string `json:"subjectId,omitempty" url:"subjectId,omitempty"` SubjectRelation string `json:"subjectRelation,omitempty" url:"subjectRelation,omitempty"` }
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 Object ¶
type Object struct { ObjectType string `json:"objectType"` ObjectId string `json:"objectId"` Meta map[string]interface{} `json:"meta"` }
func (Object) GetObjectId ¶
func (Object) GetObjectType ¶
type ObjectParams ¶
type ObjectParams struct { RequestOptions ObjectType string `json:"objectType"` ObjectId string `json:"objectId,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"` }
type ObjectType ¶
type ObjectTypeParams ¶
type ObjectTypeParams struct { RequestOptions Type string `json:"type"` Relations map[string]interface{} `json:"relations"` }
type Permission ¶
type Permission struct { PermissionId string `json:"permissionId"` Meta map[string]interface{} `json:"meta,omitempty"` }
func (Permission) GetObjectId ¶
func (permission Permission) GetObjectId() string
func (Permission) GetObjectType ¶
func (permission Permission) GetObjectType() string
type PermissionCheckParams ¶
type PermissionCheckParams struct { RequestOptions PermissionId string `json:"permissionId"` UserId string `json:"userId"` Context PolicyContext `json:"context,omitempty"` Debug bool `json:"debug,omitempty"` }
type PermissionParams ¶
type PermissionParams struct { RequestOptions PermissionId string `json:"permissionId"` Meta map[string]interface{} `json:"meta,omitempty"` }
type PolicyContext ¶
type PolicyContext map[string]interface{}
type PricingTier ¶
type PricingTier struct { PricingTierId string `json:"pricingTierId"` Meta map[string]interface{} `json:"meta,omitempty"` }
func (PricingTier) GetObjectId ¶
func (pricingTier PricingTier) GetObjectId() string
func (PricingTier) GetObjectType ¶
func (pricingTier PricingTier) GetObjectType() string
type PricingTierParams ¶
type PricingTierParams struct { RequestOptions PricingTierId string `json:"pricingTierId"` Meta map[string]interface{} `json:"meta,omitempty"` }
type QueryParams ¶
type QueryParams struct {
ListParams
}
type QueryResponse ¶
type QueryResponse struct { Results []QueryResult `json:"results"` LastId *string `json:"lastId,omitempty"` }
type QueryResult ¶
type RequestOptions ¶
type RequestOptions struct {
WarrantToken string `json:"warrantToken,omitempty" url:"warrantToken,omitempty"`
}
func (*RequestOptions) SetWarrantToken ¶
func (requestOptions *RequestOptions) SetWarrantToken(token string)
type Role ¶
type Role struct { RoleId string `json:"roleId"` Meta map[string]interface{} `json:"meta,omitempty"` }
func (Role) GetObjectId ¶
func (Role) GetObjectType ¶
type RoleCheckParams ¶
type RoleCheckParams struct { RequestOptions RoleId string `json:"roleId"` UserId string `json:"userId"` Context PolicyContext `json:"context,omitempty"` Debug bool `json:"debug,omitempty"` }
type RoleParams ¶
type RoleParams struct { RequestOptions RoleId string `json:"roleId"` Meta map[string]interface{} `json:"meta,omitempty"` }
type SelfServiceSessionParams ¶
type SelfServiceSessionParams struct { UserId string `json:"userId"` TenantId string `json:"tenantId"` TTL int64 `json:"ttl,omitempty"` Context PolicyContext `json:"context,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 ¶
func (Subject) GetRelation ¶
type Tenant ¶
type Tenant struct { TenantId string `json:"tenantId"` Meta map[string]interface{} `json:"meta,omitempty"` }
func (Tenant) GetObjectId ¶
func (Tenant) GetObjectType ¶
type TenantParams ¶
type TenantParams struct { RequestOptions TenantId string `json:"tenantId,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"` }
type User ¶
type User struct { UserId string `json:"userId"` Meta map[string]interface{} `json:"meta,omitempty"` }
func (User) GetObjectId ¶
func (User) GetObjectType ¶
type UserParams ¶
type UserParams struct { RequestOptions UserId string `json:"userId,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"` }
type Warrant ¶
type Warrant struct { ObjectType string `json:"objectType"` ObjectId string `json:"objectId"` Relation string `json:"relation"` Subject Subject `json:"subject"` Policy string `json:"policy,omitempty"` IsImplicit bool `json:"isImplicit,omitempty"` WarrantToken string `json:"warrantToken,omitempty"` }
func BatchCreate ¶
func BatchCreate(params []WarrantParams) ([]Warrant, error)
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 PolicyContext `json:"context,omitempty"` }
func (WarrantCheck) MarshalJSON ¶
func (warrantCheck WarrantCheck) MarshalJSON() ([]byte, error)
type WarrantCheckManyParams ¶
type WarrantCheckManyParams struct { RequestOptions Op string `json:"op"` Warrants []WarrantCheck `json:"warrants"` Debug bool `json:"debug,omitempty"` }
type WarrantCheckParams ¶
type WarrantCheckParams struct { RequestOptions WarrantCheck WarrantCheck `json:"warrantCheck"` Debug bool `json:"debug,omitempty"` }
type WarrantCheckResult ¶
type WarrantClient ¶
type WarrantClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config ClientConfig) WarrantClient
func (WarrantClient) BatchCreate ¶
func (c WarrantClient) BatchCreate(params []WarrantParams) ([]Warrant, error)
func (WarrantClient) BatchDelete ¶
func (c WarrantClient) BatchDelete(params []WarrantParams) (string, error)
func (WarrantClient) Check ¶
func (c WarrantClient) Check(params *WarrantCheckParams) (bool, error)
func (WarrantClient) CheckHasFeature ¶
func (c WarrantClient) CheckHasFeature(params *FeatureCheckParams) (bool, error)
func (WarrantClient) CheckMany ¶
func (c WarrantClient) CheckMany(params *WarrantCheckManyParams) (bool, error)
func (WarrantClient) CheckUserHasPermission ¶
func (c WarrantClient) CheckUserHasPermission(params *PermissionCheckParams) (bool, error)
func (WarrantClient) CheckUserHasRole ¶
func (c WarrantClient) CheckUserHasRole(params *RoleCheckParams) (bool, error)
func (WarrantClient) Create ¶
func (c WarrantClient) Create(params *WarrantParams) (*Warrant, error)
func (WarrantClient) Delete ¶
func (c WarrantClient) Delete(params *WarrantParams) (string, error)
func (WarrantClient) ListWarrants ¶ added in v6.1.1
func (c WarrantClient) ListWarrants(listParams *ListWarrantParams) (ListResponse[Warrant], error)
func (WarrantClient) Query ¶
func (c WarrantClient) Query(queryString string, params *QueryParams) (ListResponse[QueryResult], error)
type WarrantObject ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.