Documentation ¶
Index ¶
Constants ¶
View Source
const ( // AccessTokenAudienceName is the audience name of the access token. AccessTokenAudienceName = "user.access-token" // RefreshTokenAudienceName is the audience name of the refresh token. RefreshTokenAudienceName = "user.refresh-token" // RefreshThresholdDuration is the threshold duration for refreshing token. RefreshThresholdDuration = 1 * time.Hour // CookieExpDuration expires slightly earlier than the jwt expiration. Client would be logged out if the user // cookie expires, thus the client would always logout first before attempting to make a request with the expired jwt. // Suppose we have a valid refresh token, we will refresh the token in 2 cases: // 1. The access token is about to expire in <<refreshThresholdDuration>> // 2. The access token has already expired, we refresh the token so that the ongoing request can pass through. CookieExpDuration = refreshTokenDuration - 1*time.Minute // AccessTokenCookieName is the cookie name of access token. AccessTokenCookieName = "access-token" // RefreshTokenCookieName is the cookie name of refresh token. RefreshTokenCookieName = "refresh-token" // UserIDCookieName is the cookie name of user ID. UserIDCookieName = "user" )
Variables ¶
This section is empty.
Functions ¶
func GenerateAPIToken ¶
GenerateAPIToken generates an API token.
func GenerateAccessToken ¶
GenerateAccessToken generates an access token for web.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.