sessmodels

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: Apache-2.0 Imports: 4 Imported by: 55

Documentation

Index

Constants

View Source
const SessionContext int = iota

Variables

This section is empty.

Functions

This section is empty.

Types

type APIInterface

type APIInterface struct {
	RefreshPOST   *func(options APIOptions, userContext supertokens.UserContext) error
	SignOutPOST   *func(options APIOptions, userContext supertokens.UserContext) (SignOutPOSTResponse, error)
	VerifySession *func(verifySessionOptions *VerifySessionOptions, options APIOptions, userContext supertokens.UserContext) (*SessionContainer, error)
}

type APIOptions

type APIOptions struct {
	RecipeImplementation RecipeInterface
	Config               TypeNormalisedInput
	RecipeID             string
	Req                  *http.Request
	Res                  http.ResponseWriter
	OtherHandler         http.HandlerFunc
}

type CreateOrRefreshAPIResponse

type CreateOrRefreshAPIResponse struct {
	Session        SessionStruct                   `json:"session"`
	AccessToken    CreateOrRefreshAPIResponseToken `json:"accessToken"`
	RefreshToken   CreateOrRefreshAPIResponseToken `json:"refreshToken"`
	IDRefreshToken CreateOrRefreshAPIResponseToken `json:"idRefreshToken"`
	AntiCsrfToken  *string                         `json:"antiCsrfToken"`
}

type CreateOrRefreshAPIResponseToken

type CreateOrRefreshAPIResponseToken struct {
	Token       string `json:"token"`
	Expiry      uint64 `json:"expiry"`
	CreatedTime uint64 `json:"createdTime"`
}

type ErrorHandlers

type ErrorHandlers struct {
	OnUnauthorised       func(message string, req *http.Request, res http.ResponseWriter) error
	OnTokenTheftDetected func(sessionHandle string, userID string, req *http.Request, res http.ResponseWriter) error
}

type GetSessionResponse

type GetSessionResponse struct {
	Session     SessionStruct                   `json:"session"`
	AccessToken CreateOrRefreshAPIResponseToken `json:"accessToken"`
}

type HandshakeInfo

type HandshakeInfo struct {
	AntiCsrf                       string
	AccessTokenBlacklistingEnabled bool
	AccessTokenValidity            uint64
	RefreshTokenValidity           uint64
	// contains filtered or unexported fields
}

func (*HandshakeInfo) GetJwtSigningPublicKeyList added in v0.0.2

func (h *HandshakeInfo) GetJwtSigningPublicKeyList() []KeyInfo

func (*HandshakeInfo) SetJwtSigningPublicKeyList added in v0.0.2

func (h *HandshakeInfo) SetJwtSigningPublicKeyList(updatedList []KeyInfo)

type JWTInputConfig added in v0.3.2

type JWTInputConfig struct {
	Issuer                           *string
	Enable                           bool
	PropertyNameInAccessTokenPayload *string
}

type JWTNormalisedConfig added in v0.3.2

type JWTNormalisedConfig struct {
	Issuer                           *string
	Enable                           bool
	PropertyNameInAccessTokenPayload string
}

type KeyInfo added in v0.0.2

type KeyInfo struct {
	PublicKey  string
	ExpiryTime uint64
	CreatedAt  uint64
}

type NormalisedErrorHandlers

type NormalisedErrorHandlers struct {
	OnUnauthorised       func(message string, req *http.Request, res http.ResponseWriter) error
	OnTryRefreshToken    func(message string, req *http.Request, res http.ResponseWriter) error
	OnTokenTheftDetected func(sessionHandle string, userID string, req *http.Request, res http.ResponseWriter) error
}

type OverrideStruct

type OverrideStruct struct {
	Functions     func(originalImplementation RecipeInterface) RecipeInterface
	APIs          func(originalImplementation APIInterface) APIInterface
	OpenIdFeature *openidmodels.OverrideStruct
}

type RecipeInterface

type RecipeInterface struct {
	CreateNewSession            *func(res http.ResponseWriter, userID string, accessTokenPayload map[string]interface{}, sessionData map[string]interface{}, userContext supertokens.UserContext) (SessionContainer, error)
	GetSession                  *func(req *http.Request, res http.ResponseWriter, options *VerifySessionOptions, userContext supertokens.UserContext) (*SessionContainer, error)
	RefreshSession              *func(req *http.Request, res http.ResponseWriter, userContext supertokens.UserContext) (SessionContainer, error)
	GetSessionInformation       *func(sessionHandle string, userContext supertokens.UserContext) (SessionInformation, error)
	RevokeAllSessionsForUser    *func(userID string, userContext supertokens.UserContext) ([]string, error)
	GetAllSessionHandlesForUser *func(userID string, userContext supertokens.UserContext) ([]string, error)
	RevokeSession               *func(sessionHandle string, userContext supertokens.UserContext) (bool, error)
	RevokeMultipleSessions      *func(sessionHandles []string, userContext supertokens.UserContext) ([]string, error)
	UpdateSessionData           *func(sessionHandle string, newSessionData map[string]interface{}, userContext supertokens.UserContext) error
	UpdateAccessTokenPayload    *func(sessionHandle string, newAccessTokenPayload map[string]interface{}, userContext supertokens.UserContext) error
	GetAccessTokenLifeTimeMS    *func(userContext supertokens.UserContext) (uint64, error)
	GetRefreshTokenLifeTimeMS   *func(userContext supertokens.UserContext) (uint64, error)
	RegenerateAccessToken       *func(accessToken string, newAccessTokenPayload *map[string]interface{}, userContext supertokens.UserContext) (RegenerateAccessTokenResponse, error)
}

type RegenerateAccessTokenResponse added in v0.5.0

type RegenerateAccessTokenResponse struct {
	Status      string                          `json:"status"`
	Session     SessionStruct                   `json:"session"`
	AccessToken CreateOrRefreshAPIResponseToken `json:"accessToken"`
}

type SessionContainer

type SessionContainer struct {
	RevokeSession            func() error
	GetSessionData           func() (map[string]interface{}, error)
	UpdateSessionData        func(newSessionData map[string]interface{}) error
	GetUserID                func() string
	GetAccessTokenPayload    func() map[string]interface{}
	GetHandle                func() string
	GetAccessToken           func() string
	UpdateAccessTokenPayload func(newAccessTokenPayload map[string]interface{}) error
	GetTimeCreated           func() (uint64, error)
	GetExpiry                func() (uint64, error)

	RevokeSessionWithContext            func(userContext supertokens.UserContext) error
	GetSessionDataWithContext           func(userContext supertokens.UserContext) (map[string]interface{}, error)
	UpdateSessionDataWithContext        func(newSessionData map[string]interface{}, userContext supertokens.UserContext) error
	GetUserIDWithContext                func(userContext supertokens.UserContext) string
	GetAccessTokenPayloadWithContext    func(userContext supertokens.UserContext) map[string]interface{}
	GetHandleWithContext                func(userContext supertokens.UserContext) string
	GetAccessTokenWithContext           func(userContext supertokens.UserContext) string
	UpdateAccessTokenPayloadWithContext func(newAccessTokenPayload map[string]interface{}, userContext supertokens.UserContext) error
	GetTimeCreatedWithContext           func(userContext supertokens.UserContext) (uint64, error)
	GetExpiryWithContext                func(userContext supertokens.UserContext) (uint64, error)
}

type SessionInformation

type SessionInformation struct {
	SessionHandle      string
	UserId             string
	SessionData        map[string]interface{}
	Expiry             uint64
	AccessTokenPayload map[string]interface{}
	TimeCreated        uint64
}

type SessionStruct

type SessionStruct struct {
	Handle                string                 `json:"handle"`
	UserID                string                 `json:"userId"`
	UserDataInAccessToken map[string]interface{} `json:"userDataInJWT"`
}

type SignOutPOSTResponse

type SignOutPOSTResponse struct {
	OK *struct{}
}

type TypeInput

type TypeInput struct {
	CookieSecure             *bool
	CookieSameSite           *string
	SessionExpiredStatusCode *int
	CookieDomain             *string
	AntiCsrf                 *string
	Override                 *OverrideStruct
	ErrorHandlers            *ErrorHandlers
	Jwt                      *JWTInputConfig
}

type TypeNormalisedInput

type TypeNormalisedInput struct {
	RefreshTokenPath         supertokens.NormalisedURLPath
	CookieDomain             *string
	CookieSameSite           string
	CookieSecure             bool
	SessionExpiredStatusCode int
	AntiCsrf                 string
	Override                 OverrideStruct
	ErrorHandlers            NormalisedErrorHandlers
	Jwt                      JWTNormalisedConfig
}

type VerifySessionOptions

type VerifySessionOptions struct {
	AntiCsrfCheck   *bool
	SessionRequired *bool
}

Jump to

Keyboard shortcuts

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