Documentation
¶
Index ¶
- Variables
- func CreateGitCollabJwt(username string, gitID int64, secret string) (string, error)
- func GetExpTime(tokenString string) (time.Time, error)
- func GetJwtFromHeader(r *http.Request) string
- func InsertJwtBlacklist(pg *db.PostgresDriver, jwtString string) error
- func JWTBlackList(db *db.PostgresDriver) func(http.Handler) http.Handler
- type GitCollabJwtConf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ContextKeyUser = contextKey("user") ContextGitId = contextKey("gitid") )
Functions ¶
func CreateGitCollabJwt ¶
Create a new JWT for the frontend (NOT GITHUB). All requests from the frontend will contain this JWT, if modified or expired, will return error to frontend
func GetExpTime ¶
Get the time a given JWT expires at. Takes the jwt string and returns time it expires at as time.Time
func GetJwtFromHeader ¶
Retrieve JWT from the header, return empty string if no JWT
func InsertJwtBlacklist ¶
func InsertJwtBlacklist(pg *db.PostgresDriver, jwtString string) error
Insert a JWT to the blacklist table. Any requests with a header containing this JWT will return an error to the frontend
func JWTBlackList ¶
Middleware to check if a given JWT is blacklisted All private routes with JWT headers should pass through this middleware
Types ¶
type GitCollabJwtConf ¶
type GitCollabJwtConf struct {
// contains filtered or unexported fields
}
func NewGitCollabJwtConf ¶
func NewGitCollabJwtConf(secret string) *GitCollabJwtConf
Click to show internal directories.
Click to hide internal directories.