Documentation
¶
Index ¶
- func GetServer() *server.Server
- type GitHubUser
- type GithubAuthApi
- func (api *GithubAuthApi) AuthorizeGithub(c *gin.Context)
- func (api *GithubAuthApi) AuthorizeGithubUrl(c *gin.Context)
- func (api *GithubAuthApi) CheckNativeToken(c *gin.Context)
- func (api *GithubAuthApi) GetGithubToken(c *gin.Context)
- func (api *GithubAuthApi) GetNativeToken(c *gin.Context)
- func (api *GithubAuthApi) Login(c *gin.Context)
- type InternalAuthApi
- func (api *InternalAuthApi) ClientSecretLogin(c *gin.Context)
- func (api *InternalAuthApi) GetRedirectUrl(c *gin.Context)
- func (api *InternalAuthApi) GetToken(c *gin.Context)
- func (api *InternalAuthApi) PassordLogin(c *gin.Context)
- func (api *InternalAuthApi) RefreshToken(c *gin.Context)
- func (api *InternalAuthApi) TestAccess(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GitHubUser ¶
type GithubAuthApi ¶
type GithubAuthApi struct { ConfGitHub *oauth2.Config Repo repository.UserRepo // contains filtered or unexported fields }
func ProvideGithubAuth ¶
func ProvideGithubAuth(repo repository.UserRepo, awsService *aws.AWSService, jwtService *jwt.TokenService) *GithubAuthApi
func (*GithubAuthApi) AuthorizeGithub ¶
func (api *GithubAuthApi) AuthorizeGithub(c *gin.Context)
AuthorizeGithub
generate github authorize url and redirect directly
func (*GithubAuthApi) AuthorizeGithubUrl ¶
func (api *GithubAuthApi) AuthorizeGithubUrl(c *gin.Context)
AuthorizeGithubUrl generate github authorize url and return url
func (*GithubAuthApi) CheckNativeToken ¶
func (api *GithubAuthApi) CheckNativeToken(c *gin.Context)
CheckNativeToken - verify native token
func (*GithubAuthApi) GetGithubToken ¶
func (api *GithubAuthApi) GetGithubToken(c *gin.Context)
GetGithubToken
redirect from github with code, call github api again in backend (for security reason), get access token generated by github
*
func (*GithubAuthApi) GetNativeToken ¶
func (api *GithubAuthApi) GetNativeToken(c *gin.Context)
GetNativeToken - Get github user info and register into to our database, finally generate native jwt token
- get github user
- check native user by email 2.1 update native user -- email exists 2.2 add native user -- email not exists 3 generate jwt token 4 return token
func (*GithubAuthApi) Login ¶
func (api *GithubAuthApi) Login(c *gin.Context)
a combined API to get native token by auth code from github:
- use github auth code + state to get github token;
- use github token to get github user info;
- ensure github user email registered in our system;
- register new user if not already exists;
- generate token with our own signature.
type InternalAuthApi ¶
type InternalAuthApi struct { NativeServer *server.Server // contains filtered or unexported fields }
func ProvideInternalAuthApi ¶
func ProvideInternalAuthApi(awsService *aws.AWSService) *InternalAuthApi
func (*InternalAuthApi) ClientSecretLogin ¶
func (api *InternalAuthApi) ClientSecretLogin(c *gin.Context)
func (*InternalAuthApi) GetRedirectUrl ¶
func (api *InternalAuthApi) GetRedirectUrl(c *gin.Context)
func (*InternalAuthApi) GetToken ¶
func (api *InternalAuthApi) GetToken(c *gin.Context)
func (*InternalAuthApi) PassordLogin ¶
func (api *InternalAuthApi) PassordLogin(c *gin.Context)
func (*InternalAuthApi) RefreshToken ¶
func (api *InternalAuthApi) RefreshToken(c *gin.Context)
func (*InternalAuthApi) TestAccess ¶
func (api *InternalAuthApi) TestAccess(c *gin.Context)
Click to show internal directories.
Click to hide internal directories.