Documentation ¶
Index ¶
- Constants
- Variables
- func AddPostInitCallback(cb func() error)
- func ConvertGeneralErrorToJsonResponse(resp GeneralErrorResponse) map[string]interface{}
- func DeleteUser(userId string) error
- func DoesSliceContainString(a string, list []string) bool
- func ErrorHandler(err error, req *http.Request, res http.ResponseWriter, ...) error
- func ErrorIfNoResponse(res http.ResponseWriter) error
- func GetAllCORSHeaders() []string
- func GetAllCoreUrlsForPath(path string) []string
- func GetInstanceOrThrowError() (*superTokens, error)
- func GetRequestFromUserContext(userContext UserContext) *http.Request
- func GetTopLevelDomainForSameSiteResolution(URL string) (string, error)
- func GetUserCount(includeRecipeIds *[]string, tenantId *string) (float64, error)
- func HumaniseMilliseconds(m uint64) string
- func Init(config TypeInput) error
- func IsAnIPAddress(ipaddress string) (bool, error)
- func IsRunningInTestMode() bool
- func LogDebugMessage(message string)
- func MapToStruct(val map[string]interface{}, v interface{}) error
- func MaxVersion(version1 string, version2 string) string
- func Middleware(theirHandler http.Handler) http.Handler
- func ReadFromRequest(r *http.Request) ([]byte, error)
- func ResetForTest()
- func ResetQuerierForTest()
- func Send200Response(res http.ResponseWriter, responseJson interface{}) error
- func SendHTMLResponse(res http.ResponseWriter, statusCode int, htmlString string) error
- func SendNon200Response(res http.ResponseWriter, statusCode int, body map[string]interface{}) error
- func SendNon200ResponseWithMessage(res http.ResponseWriter, message string, statusCode int) error
- func SendUnauthorisedAccess(res http.ResponseWriter) error
- func SetQuerierApiVersionForTests(version string)
- func StructToMap(val interface{}) (map[string]interface{}, error)
- type APIHandled
- type AppInfo
- type BadInputError
- type ConnectionInfo
- type CreateUserIdMappingResult
- type DeleteUserIdMappingResult
- type DoneWriter
- type GeneralErrorResponse
- type GetUserIdMappingResult
- type NormalisedAppinfo
- type NormalisedURLDomain
- type NormalisedURLPath
- func (n NormalisedURLPath) AppendPath(other NormalisedURLPath) NormalisedURLPath
- func (n NormalisedURLPath) Equals(other NormalisedURLPath) bool
- func (n NormalisedURLPath) GetAsStringDangerous() string
- func (n NormalisedURLPath) IsARecipePath() bool
- func (n NormalisedURLPath) StartsWith(other NormalisedURLPath) bool
- type Querier
- func (q *Querier) GetQuerierAPIVersion() (string, error)
- func (q *Querier) SendDeleteRequest(path string, data map[string]interface{}, params map[string]string, ...) (map[string]interface{}, error)
- func (q *Querier) SendGetRequest(path string, params map[string]string, userContext UserContext) (map[string]interface{}, error)
- func (q *Querier) SendGetRequestWithResponseHeaders(path string, params map[string]string, userContext UserContext) (map[string]interface{}, http.Header, error)
- func (q *Querier) SendPostRequest(path string, data map[string]interface{}, userContext UserContext) (map[string]interface{}, error)
- func (q *Querier) SendPutRequest(path string, data map[string]interface{}, userContext UserContext) (map[string]interface{}, error)
- func (q *Querier) SetApiVersionForTests(apiVersion string)
- type QuerierHost
- type Recipe
- type RecipeModule
- type TypeInput
- type UpdateOrDeleteUserIdMappingInfoResult
- type UserContext
- type UserIdType
- type UserPaginationResult
- func GetUsersNewestFirst(tenantId string, paginationToken *string, limit *int, ...) (UserPaginationResult, error)
- func GetUsersOldestFirst(tenantId string, paginationToken *string, limit *int, ...) (UserPaginationResult, error)
- func GetUsersWithSearchParams(tenantId string, timeJoinedOrder string, paginationToken *string, limit *int, ...) (UserPaginationResult, error)
Constants ¶
View Source
const ( HeaderRID = "rid" HeaderFDI = "fdi-version" )
View Source
const DashboardVersion = "0.7"
View Source
const DefaultTenantId string = "public"
View Source
const RateLimitStatusCode = 429
View Source
const VERSION = "0.20.0"
VERSION current version of the lib
Variables ¶
View Source
var ( QuerierHosts []QuerierHost = nil QuerierAPIKey *string )
View Source
var GetTenantIdFuncFromUsingMultitenancyRecipe func(tenantIdFromFrontend string, userContext UserContext) (string, error)
This function is required to be here because calling multitenancy recipe from this module causes cyclic dependency this function is initialized by the init function in multitenancy recipe
View Source
var IsTestFlag = false
this will be set to true if this is used in a test app environment
Functions ¶
func AddPostInitCallback ¶
func AddPostInitCallback(cb func() error)
func ConvertGeneralErrorToJsonResponse ¶
func ConvertGeneralErrorToJsonResponse(resp GeneralErrorResponse) map[string]interface{}
func DeleteUser ¶
func DoesSliceContainString ¶
func ErrorHandler ¶
func ErrorHandler(err error, req *http.Request, res http.ResponseWriter, userContext ...UserContext) error
func ErrorIfNoResponse ¶
func ErrorIfNoResponse(res http.ResponseWriter) error
func GetAllCORSHeaders ¶
func GetAllCORSHeaders() []string
func GetAllCoreUrlsForPath ¶
func GetInstanceOrThrowError ¶
func GetInstanceOrThrowError() (*superTokens, error)
func GetRequestFromUserContext ¶
func GetRequestFromUserContext(userContext UserContext) *http.Request
func GetUserCount ¶
func HumaniseMilliseconds ¶
func IsAnIPAddress ¶
func IsRunningInTestMode ¶
func IsRunningInTestMode() bool
func LogDebugMessage ¶
func LogDebugMessage(message string)
func MapToStruct ¶
func MaxVersion ¶
MaxVersion returns max of v1 and v2
func ResetForTest ¶
func ResetForTest()
func ResetQuerierForTest ¶
func ResetQuerierForTest()
func Send200Response ¶
func Send200Response(res http.ResponseWriter, responseJson interface{}) error
func SendHTMLResponse ¶
func SendHTMLResponse(res http.ResponseWriter, statusCode int, htmlString string) error
func SendNon200Response ¶
func SendNon200Response(res http.ResponseWriter, statusCode int, body map[string]interface{}) error
func SendNon200ResponseWithMessage ¶
func SendNon200ResponseWithMessage(res http.ResponseWriter, message string, statusCode int) error
func SendUnauthorisedAccess ¶
func SendUnauthorisedAccess(res http.ResponseWriter) error
func SetQuerierApiVersionForTests ¶
func SetQuerierApiVersionForTests(version string)
func StructToMap ¶
Types ¶
type APIHandled ¶
type APIHandled struct { PathWithoutAPIBasePath NormalisedURLPath Method string ID string Disabled bool }
type BadInputError ¶
type BadInputError struct {
Msg string
}
BadInputError used for non specific exceptions
func (BadInputError) Error ¶
func (err BadInputError) Error() string
type ConnectionInfo ¶
type CreateUserIdMappingResult ¶
type CreateUserIdMappingResult struct { OK *struct{} UnknownSupertokensUserIdError *struct{} UserIdMappingAlreadyExistsError *struct { DoesSuperTokensUserIdExist bool DoesExternalUserIdExist bool } }
func CreateUserIdMapping ¶
type DeleteUserIdMappingResult ¶
type DeleteUserIdMappingResult struct { OK *struct { DidMappingExist bool } }
func DeleteUserIdMapping ¶
func DeleteUserIdMapping(userId string, userIdType *UserIdType, force *bool) (DeleteUserIdMappingResult, error)
type DoneWriter ¶
type DoneWriter interface { http.ResponseWriter IsDone() bool }
func MakeDoneWriter ¶
func MakeDoneWriter(w http.ResponseWriter) DoneWriter
WrapWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.
type GeneralErrorResponse ¶
type GeneralErrorResponse struct {
Message string
}
type GetUserIdMappingResult ¶
type GetUserIdMappingResult struct { OK *struct { SupertokensUserId string ExternalUserId string ExternalUserIdInfo *string } UnknownMappingError *struct{} }
func GetUserIdMapping ¶
func GetUserIdMapping(userId string, userIdType *UserIdType) (GetUserIdMappingResult, error)
type NormalisedAppinfo ¶
type NormalisedAppinfo struct { AppName string GetOrigin func(request *http.Request, userContext UserContext) (NormalisedURLDomain, error) APIDomain NormalisedURLDomain TopLevelAPIDomain string GetTopLevelWebsiteDomain func(request *http.Request, userContext UserContext) (string, error) APIBasePath NormalisedURLPath APIGatewayPath NormalisedURLPath WebsiteBasePath NormalisedURLPath }
func NormaliseInputAppInfoOrThrowError ¶
func NormaliseInputAppInfoOrThrowError(appInfo AppInfo) (NormalisedAppinfo, error)
type NormalisedURLDomain ¶
type NormalisedURLDomain struct {
// contains filtered or unexported fields
}
func NewNormalisedURLDomain ¶
func NewNormalisedURLDomain(url string) (NormalisedURLDomain, error)
func (NormalisedURLDomain) GetAsStringDangerous ¶
func (n NormalisedURLDomain) GetAsStringDangerous() string
type NormalisedURLPath ¶
type NormalisedURLPath struct {
// contains filtered or unexported fields
}
func NewNormalisedURLPath ¶
func NewNormalisedURLPath(url string) (NormalisedURLPath, error)
func (NormalisedURLPath) AppendPath ¶
func (n NormalisedURLPath) AppendPath(other NormalisedURLPath) NormalisedURLPath
func (NormalisedURLPath) Equals ¶
func (n NormalisedURLPath) Equals(other NormalisedURLPath) bool
func (NormalisedURLPath) GetAsStringDangerous ¶
func (n NormalisedURLPath) GetAsStringDangerous() string
func (NormalisedURLPath) IsARecipePath ¶
func (n NormalisedURLPath) IsARecipePath() bool
func (NormalisedURLPath) StartsWith ¶
func (n NormalisedURLPath) StartsWith(other NormalisedURLPath) bool
type Querier ¶
type Querier struct {
RIDToCore string
}
func (*Querier) GetQuerierAPIVersion ¶
func (*Querier) SendDeleteRequest ¶
func (*Querier) SendGetRequest ¶
func (*Querier) SendGetRequestWithResponseHeaders ¶
func (*Querier) SendPostRequest ¶
func (*Querier) SendPutRequest ¶
func (*Querier) SetApiVersionForTests ¶
type QuerierHost ¶
type QuerierHost struct { Domain NormalisedURLDomain BasePath NormalisedURLPath }
type Recipe ¶
type Recipe func(appInfo NormalisedAppinfo, onSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter)) (*RecipeModule, error)
var DefaultMultitenancyRecipe Recipe
type RecipeModule ¶
type RecipeModule struct { HandleAPIRequest func(ID string, tenantId string, req *http.Request, res http.ResponseWriter, theirHandler http.HandlerFunc, path NormalisedURLPath, method string, userContext UserContext) error GetAllCORSHeaders func() []string GetAPIsHandled func() ([]APIHandled, error) ReturnAPIIdIfCanHandleRequest func(path NormalisedURLPath, method string, userContext UserContext) (*string, string, error) HandleError func(err error, req *http.Request, res http.ResponseWriter, userContext UserContext) (bool, error) OnSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter) ResetForTest func() // contains filtered or unexported fields }
func MakeRecipeModule ¶
func MakeRecipeModule( recipeId string, appInfo NormalisedAppinfo, handleAPIRequest func(id string, tenantId string, req *http.Request, res http.ResponseWriter, theirHandler http.HandlerFunc, path NormalisedURLPath, method string, userContext UserContext) error, getAllCORSHeaders func() []string, getAPIsHandled func() ([]APIHandled, error), returnAPIIdIfCanHandleRequest func(path NormalisedURLPath, method string, userContext UserContext) (*string, string, error), handleError func(err error, req *http.Request, res http.ResponseWriter, userContext UserContext) (bool, error), onSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter)) RecipeModule
func (RecipeModule) GetAppInfo ¶
func (r RecipeModule) GetAppInfo() NormalisedAppinfo
func (RecipeModule) GetRecipeID ¶
func (r RecipeModule) GetRecipeID() string
type TypeInput ¶
type TypeInput struct { Supertokens *ConnectionInfo AppInfo AppInfo RecipeList []Recipe Telemetry *bool Debug bool OnSuperTokensAPIError func(err error, req *http.Request, res http.ResponseWriter) }
type UpdateOrDeleteUserIdMappingInfoResult ¶
type UpdateOrDeleteUserIdMappingInfoResult struct { OK *struct{} UnknownMappingError *struct{} }
func UpdateOrDeleteUserIdMappingInfo ¶
func UpdateOrDeleteUserIdMappingInfo(userId string, userIdType *UserIdType, externalUserIdInfo *string) (UpdateOrDeleteUserIdMappingInfoResult, error)
type UserContext ¶
type UserContext = *map[string]interface{}
func MakeDefaultUserContextFromAPI ¶
func MakeDefaultUserContextFromAPI(r *http.Request) UserContext
func SetRequestInUserContextIfNotDefined ¶
func SetRequestInUserContextIfNotDefined(userContext *map[string]interface{}, r *http.Request) UserContext
type UserIdType ¶
type UserIdType string
const ( UserIdTypeAny UserIdType = "ANY" UserIdTypeSupertokens UserIdType = "SUPERTOKENS" UserIdTypeExternal UserIdType = "EXTERNAL" )
type UserPaginationResult ¶
type UserPaginationResult struct { Users []struct { RecipeId string `json:"recipeId"` User map[string]interface{} `json:"user"` } NextPaginationToken *string }
func GetUsersNewestFirst ¶
func GetUsersOldestFirst ¶
Click to show internal directories.
Click to hide internal directories.