claims

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 2 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BooleanClaim

func BooleanClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInSeconds *int64) (*TypeSessionClaim, BooleanClaimValidators)

func PrimitiveArrayClaim

func PrimitiveArrayClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInSeconds *int64) (*TypeSessionClaim, PrimitiveArrayClaimValidators)

func PrimitiveClaim

func PrimitiveClaim(key string, fetchValue FetchValueFunc, defaultMaxAgeInSeconds *int64) (*TypeSessionClaim, PrimitiveClaimValidators)

Types

type BooleanClaimValidators

type BooleanClaimValidators struct {
	PrimitiveClaimValidators
	IsTrue  func(maxAgeInSeconds *int64, id *string) SessionClaimValidator
	IsFalse func(maxAgeInSeconds *int64, id *string) SessionClaimValidator
}

type ClaimValidationError

type ClaimValidationError struct {
	ID     string      `json:"id"`
	Reason interface{} `json:"reason,omitempty"` // This can be nil, add checks when used
}

type ClaimValidationResult

type ClaimValidationResult struct {
	IsValid bool
	Reason  interface{} // This can be nil, add checks when used
}

type FetchValueFunc

type FetchValueFunc func(userId string, userContext supertokens.UserContext) (interface{}, error)

type PrimitiveArrayClaimValidators

type PrimitiveArrayClaimValidators struct {
	Includes    func(val interface{}, maxAgeInSeconds *int64, id *string) SessionClaimValidator
	Excludes    func(val interface{}, maxAgeInSeconds *int64, id *string) SessionClaimValidator
	IncludesAll func(vals []interface{}, maxAgeInSeconds *int64, id *string) SessionClaimValidator
	ExcludesAll func(vals []interface{}, maxAgeInSeconds *int64, id *string) SessionClaimValidator
}

type PrimitiveClaimValidators

type PrimitiveClaimValidators struct {
	HasValue func(val interface{}, maxAgeInSeconds *int64, id *string) SessionClaimValidator
}

type SessionClaimValidator

type SessionClaimValidator struct {
	ID            string
	Claim         *TypeSessionClaim
	ShouldRefetch func(payload map[string]interface{}, userContext supertokens.UserContext) bool
	Validate      func(payload map[string]interface{}, userContext supertokens.UserContext) ClaimValidationResult
}

type TypeSessionClaim

type TypeSessionClaim struct {
	Key                               string
	FetchValue                        FetchValueFunc
	AddToPayload_internal             func(payload map[string]interface{}, value interface{}, userContext supertokens.UserContext) map[string]interface{}
	RemoveFromPayloadByMerge_internal func(payload map[string]interface{}, userContext supertokens.UserContext) map[string]interface{}
	RemoveFromPayload                 func(payload map[string]interface{}, userContext supertokens.UserContext) map[string]interface{}
	GetValueFromPayload               func(payload map[string]interface{}, userContext supertokens.UserContext) interface{}
	Build                             func(userId string, payloadToUpdate map[string]interface{}, userContext supertokens.UserContext) (map[string]interface{}, error)
}

func SessionClaim

func SessionClaim(key string, fetchValue FetchValueFunc) *TypeSessionClaim

Jump to

Keyboard shortcuts

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