Documentation
¶
Index ¶
- Variables
- func DelLoginSession(ctx context.Context, key LoginSessionKey) error
- func GenerateAuthTokenString(account string, roles ...string) (string, error)
- func GetGithubOauthEntryURL(callbackURL string) (*url.URL, error)
- func ParseAuthTokenString(tokenString string) (string, []string, error)
- func SetLoginSession(ctx context.Context, key LoginSessionKey, data LoginSessionData) error
- func UpdateLoginSessionByAccount(ctx context.Context, account string, data LoginSessionData) error
- type AuthToken
- type GithubAccessTokenResponse
- type GithubUser
- type LoginSession
- type LoginSessionData
- type LoginSessionKey
Constants ¶
This section is empty.
Variables ¶
View Source
var LoginSessionDuration time.Duration
Functions ¶
func DelLoginSession ¶
func DelLoginSession(ctx context.Context, key LoginSessionKey) error
func GenerateAuthTokenString ¶
func SetLoginSession ¶
func SetLoginSession(ctx context.Context, key LoginSessionKey, data LoginSessionData) error
func UpdateLoginSessionByAccount ¶
func UpdateLoginSessionByAccount(ctx context.Context, account string, data LoginSessionData) error
Types ¶
type AuthToken ¶
func GetAuthTokenFromJWTMapClaims ¶
func GetAuthTokenFromJWTMapClaims(claims jwt.MapClaims) *AuthToken
func (*AuthToken) ToJWTMapClaims ¶
func (a *AuthToken) ToJWTMapClaims() jwt.MapClaims
type GithubAccessTokenResponse ¶
type GithubAccessTokenResponse struct { AccessToken string `json:"access_token"` Scope string `json:"scope"` TokenType string `json:"token_type"` }
func GetGithubAccessToken ¶
func GetGithubAccessToken(code string) (*GithubAccessTokenResponse, error)
type GithubUser ¶
type GithubUser struct { Login string `json:"login"` Name string `json:"name"` Email string `json:"email"` AvatarURL string `json:"avatar_url"` }
func GetGithubUser ¶
func GetGithubUser(accessToken string) (*GithubUser, error)
type LoginSession ¶
type LoginSession struct { Key LoginSessionKey Data LoginSessionData }
func GetLoginSession ¶
func GetLoginSession(ctx context.Context, key LoginSessionKey) (*LoginSession, error)
func NewLoginSession ¶
func NewLoginSession(account string, data LoginSessionData) *LoginSession
func (LoginSession) DelInRedis ¶
func (ls LoginSession) DelInRedis(ctx context.Context) error
func (LoginSession) SaveToRedis ¶
func (ls LoginSession) SaveToRedis(ctx context.Context) error
type LoginSessionData ¶
type LoginSessionData struct { }
func (LoginSessionData) GetJsonString ¶
func (data LoginSessionData) GetJsonString() (string, error)
type LoginSessionKey ¶
Click to show internal directories.
Click to hide internal directories.