Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStarter ¶
func NewStarter() *starter
Types ¶
type Config ¶
type Config struct { WechatSignSwitch bool // 微信三方登录开关 WechatOAuth2AppKey string // 微信开发者appkey WechatOAuth2AppSecret string // 微信开发者secret WeiboSignSwitch bool // 微博三方登录开关 WeiboOAuth2AppKey string // 微博开发者appkey WeiboOAuth2AppSecret string // 微博开发者secret QQSignSwitch bool // qq三方登录开关 QQOAuth2AppKey string // qq开发者appkey QQOAuth2AppSecret string // qq开发者secret }
func DefaultConfig ¶
func DefaultConfig() *Config
type OAuth ¶
type OAuth interface { Authorize(code string) OAuthResult // 根据微信返回的accessTokenCode开始鉴权并获取用户信息 // contains filtered or unexported methods }
OAuth2服务的通用鉴权接口
type OAuthAccountInfo ¶
type OAuthAccountInfo struct { AccessToken string OpenId string UnionId string NickName string Gender uint AvatarUrl string }
OAuth授权获取的第三方账号信息
type OAuthResult ¶
type OAuthResult struct { Result bool UserInfo *OAuthAccountInfo Error error }
OAuth鉴权结果
type QQOAuthManager ¶
type QQOAuthManager struct {
// contains filtered or unexported fields
}
实现QQOAuth2鉴权
func NewQQOauthManager ¶
func NewQQOauthManager(cfg *Config) *QQOAuthManager
func XQQOAuthManager ¶
func XQQOAuthManager() *QQOAuthManager
func (*QQOAuthManager) Authorize ¶
func (oauth *QQOAuthManager) Authorize(code string) OAuthResult
通过前端与用户交互获得的预授权码code后,后端再申请accessToken获得第三方用户信息,再进入本服务的登录或注册流程
type WechatOAuthManager ¶
type WechatOAuthManager struct {
// contains filtered or unexported fields
}
实现 微信 OAuth2鉴权
func NewWechatOAuthManager ¶
func NewWechatOAuthManager(cfg *Config) *WechatOAuthManager
func XWechatOAuthManager ¶
func XWechatOAuthManager() *WechatOAuthManager
func (*WechatOAuthManager) Authorize ¶
func (oauth *WechatOAuthManager) Authorize(code string) OAuthResult
通过前端与用户交互获得的预授权码code后,后端再申请accessToken获得第三方用户信息,再进入本服务的登录或注册流程
type WeiboOAuthManager ¶
type WeiboOAuthManager struct {
// contains filtered or unexported fields
}
实现微博 OAuth2鉴权
func NewWeiboOAuthManager ¶
func NewWeiboOAuthManager(cfg *Config) *WeiboOAuthManager
func XWeiboOAuthManager ¶
func XWeiboOAuthManager() *WeiboOAuthManager
func (*WeiboOAuthManager) Authorize ¶
func (oauth *WeiboOAuthManager) Authorize(code string) OAuthResult
通过前端与用户交互获得的预授权码code后,后端再申请accessToken获得第三方用户信息,再进入本服务的登录或注册流程
Click to show internal directories.
Click to hide internal directories.