Documentation ¶
Index ¶
- func Config(config ConfigMap)
- func GetAllSessionHandlesForUser(userID string) ([]string, error)
- func GetCORSAllowedHeaders() []string
- func GetJWTPayload(sessionHandle string) (map[string]interface{}, error)
- func GetSessionData(sessionHandle string) (map[string]interface{}, error)
- func HandleErrorAndRespond(err error, w http.ResponseWriter)
- func Middleware(theirHandler http.HandlerFunc, extraParams ...interface{}) http.HandlerFunc
- func OnGeneralError(handler func(error, http.ResponseWriter))
- func OnTokenTheftDetected(handler func(string, string, http.ResponseWriter))
- func OnTryRefreshToken(handler func(error, http.ResponseWriter))
- func OnUnauthorized(handler func(error, http.ResponseWriter))
- func RevokeAllSessionsForUser(userID string) ([]string, error)
- func RevokeMultipleSessions(sessionHandles []string) ([]string, error)
- func RevokeSession(sessionHandle string) (bool, error)
- func SetRelevantHeadersForOptionsAPI(response http.ResponseWriter)
- func UpdateJWTPayload(sessionHandle string, newJWTPayload map[string]interface{}) error
- func UpdateSessionData(sessionHandle string, newSessionData map[string]interface{}) error
- type ConfigMap
- type Session
- func CreateNewSession(response http.ResponseWriter, userID string, payload ...map[string]interface{}) (Session, error)
- func GetSession(response http.ResponseWriter, request *http.Request, doAntiCsrfCheck bool) (Session, error)
- func GetSessionFromRequest(r *http.Request) *Session
- func RefreshSession(response http.ResponseWriter, request *http.Request) (Session, error)
- func (session *Session) GetAccessToken() string
- func (session *Session) GetHandle() string
- func (session *Session) GetJWTPayload() map[string]interface{}
- func (session *Session) GetSessionData() (map[string]interface{}, error)
- func (session *Session) GetUserID() string
- func (session *Session) RevokeSession() error
- func (session *Session) UpdateJWTPayload(newJWTPayload map[string]interface{}) error
- func (session *Session) UpdateSessionData(newSessionData map[string]interface{}) error
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllSessionHandlesForUser ¶
GetAllSessionHandlesForUser function used to get all sessions for a user
func GetCORSAllowedHeaders ¶ added in v1.3.0
func GetCORSAllowedHeaders() []string
GetCORSAllowedHeaders function is used to get header keys that are used by SuperTokens
func GetJWTPayload ¶
GetJWTPayload function used to get jwt payload for the given handle
func GetSessionData ¶
GetSessionData function used to get session data for the given handle
func HandleErrorAndRespond ¶
func HandleErrorAndRespond(err error, w http.ResponseWriter)
HandleErrorAndRespond if error handlers are provided, then uses those, else does default error handling depending on the type of error
func Middleware ¶
func Middleware(theirHandler http.HandlerFunc, extraParams ...interface{}) http.HandlerFunc
Middleware for verifying and refreshing session. ExtraParams are: bool, func(error, http.ResponseWriter)
func OnGeneralError ¶
func OnGeneralError(handler func(error, http.ResponseWriter))
OnGeneralError function to override default behaviour of handling general errors
func OnTokenTheftDetected ¶
func OnTokenTheftDetected(handler func(string, string, http.ResponseWriter))
OnTokenTheftDetected function to override default behaviour of handling token thefts
func OnTryRefreshToken ¶
func OnTryRefreshToken(handler func(error, http.ResponseWriter))
OnTryRefreshToken function to override default behaviour of handling try refresh token errors
func OnUnauthorized ¶
func OnUnauthorized(handler func(error, http.ResponseWriter))
OnUnauthorized function to override default behaviour of handling Unauthorized error
func RevokeAllSessionsForUser ¶
RevokeAllSessionsForUser function used to revoke all sessions for a user
func RevokeMultipleSessions ¶
RevokeMultipleSessions function used to revoke a list of sessions
func RevokeSession ¶
RevokeSession function used to revoke a specific session
func SetRelevantHeadersForOptionsAPI ¶
func SetRelevantHeadersForOptionsAPI(response http.ResponseWriter)
SetRelevantHeadersForOptionsAPI function is used to set headers specific to SuperTokens for OPTIONS API
func UpdateJWTPayload ¶
UpdateJWTPayload function used to update jwt payload for the given handle
func UpdateSessionData ¶
UpdateSessionData function used to update session data for the given handle
Types ¶
type ConfigMap ¶ added in v1.1.0
type ConfigMap struct { Hosts string AccessTokenPath string RefreshAPIPath string CookieDomain string CookieSecure *bool CookieSameSite string APIKey string }
ConfigMap add key value params for session behaviour
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session object returned for managing a session
func CreateNewSession ¶
func CreateNewSession(response http.ResponseWriter, userID string, payload ...map[string]interface{}) (Session, error)
CreateNewSession function used to create a new SuperTokens session
func GetSession ¶
func GetSession(response http.ResponseWriter, request *http.Request, doAntiCsrfCheck bool) (Session, error)
GetSession function used to verify a session
func GetSessionFromRequest ¶
GetSessionFromRequest returns the verified session object if present, otherwise returns nil
func RefreshSession ¶
RefreshSession function used to refresh a session
func (*Session) GetAccessToken ¶
GetAccessToken function gets the access token for this session
func (*Session) GetJWTPayload ¶
GetJWTPayload function gets the jwt payload for this session
func (*Session) GetSessionData ¶
GetSessionData function used to get session data for this session
func (*Session) RevokeSession ¶
RevokeSession function used to revoke a session for this session
func (*Session) UpdateJWTPayload ¶
UpdateJWTPayload function used to update jwt payload for this session
func (*Session) UpdateSessionData ¶
UpdateSessionData function used to update session data for this session