Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetToken ¶
func SetToken(w http.ResponseWriter, r *http.Request, db *mgo.Session, userID string, userGroups []string, redirectURL string, JWTAccessSecret string, JWTRefreshSecret string) *handler.AppError
SetToken sets both an access token and refresh token to the cookies An access token is base64 URL encoded A refresh token is encoded in a gorilla session After this it redirects to the given redirect url (both relative and absolute)
Types ¶
type Claims ¶
type Claims struct { ProgramVersion string `json:"programVersion"` UserAgent string `json:"userAgent"` UserGroups []string `json:"userGroups"` jwt.StandardClaims }
Claims defines what will be stored in a JWT access token
type RefreshClaims ¶
type RefreshClaims struct { UserID string `json:"userId"` UserGroups []string `bson:"userGroups"` Version string `json:"version"` RemoteAddress string `json:"remoteAddress"` UserAgent string `json:"userAgent"` jwt.StandardClaims }
RefreshClaims defines what will be in the JWT refresh token
type RefreshToken ¶
type RefreshToken struct { CreatedAt time.Time `bson:"createdAt"` UserID string `bson:"userId"` UserGroups []string `bson:"userGroups"` RefreshTokenString string `bson:"refreshTokenString"` Expire time.Time `bson:"expirationTime"` Valid bool `bson:"valid"` }
RefreshToken defines what will be stored in the database of the RefreshToken
Click to show internal directories.
Click to hide internal directories.