Documentation ¶
Index ¶
- Constants
- Variables
- func BuildWechatOpenIdKey(appId string) string
- func GetWechatOfficialAccountAccessToken(clientId string, clientSecret string) (string, string, error)
- func GetWechatOfficialAccountQRCode(clientId string, clientSecret string, providerId string) (string, string, error)
- func VerifyWechatSignature(token string, nonce string, timestamp string, signature string) bool
- type AdfsIdProvider
- type AdfsToken
- type AlipayAccessToken
- type AlipayIdProvider
- type AlipaySystemOauthTokenResponse
- type AlipayUserInfoShareResponse
- type AlipayUserResponse
- type AzureADB2CProvider
- type AzureadB2cToken
- type BaiduIdProvider
- type BaiduUserInfo
- type BilibiliIdProvider
- type BilibiliIdProviderTokenResponse
- type BilibiliProviderToken
- type BilibiliUserInfo
- type BilibiliUserInfoResponse
- type CasdoorIdProvider
- type CasdoorToken
- type CasdoorUserInfo
- type CustomIdProvider
- type CustomUserInfo
- type DingTalkAccessToken
- type DingTalkIdProvider
- type DingTalkUserResponse
- type DouyinIdProvider
- type DouyinTokenResp
- type DouyinUserInfo
- type FacebookAccessToken
- type FacebookCheckToken
- type FacebookCheckTokenData
- type FacebookIdProvider
- type FacebookUserInfo
- type GitHubUserInfo
- type GiteeAccessToken
- type GiteeIdProvider
- type GiteeUserResponse
- type GithubIdProvider
- type GithubToken
- type GitlabIdProvider
- type GitlabProviderToken
- type GitlabUserInfo
- type GoogleIdProvider
- type GoogleIdToken
- type GooglePeopleApiPhoneNumber
- type GooglePeopleApiPhoneNumberMetaData
- type GooglePeopleApiResult
- type GoogleUserInfo
- type GothIdProvider
- type IdProvider
- type InfoflowIdProvider
- type InfoflowInterToken
- type InfoflowInternalIdProvider
- type InfoflowInternalUserInfo
- type InfoflowInternalUserResp
- type InfoflowToken
- type InfoflowUserInfo
- type InfoflowUserResp
- type LarkAccessToken
- type LarkIdProvider
- type LarkUserInfo
- type LinkedInAccessToken
- type LinkedInIdProvider
- func (idp *LinkedInIdProvider) GetToken(code string) (*oauth2.Token, error)
- func (idp *LinkedInIdProvider) GetUrlRespWithAuthorization(url, token string) ([]byte, error)
- func (idp *LinkedInIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
- func (idp *LinkedInIdProvider) SetHttpClient(client *http.Client)
- type LinkedInUserEmail
- type LinkedInUserInfo
- type MetaMaskIdProvider
- type OktaIdProvider
- type OktaToken
- type OktaUserInfo
- type ProviderInfo
- type QqIdProvider
- type QqUserInfo
- type TwitterAccessToken
- type TwitterCheckToken
- type TwitterCheckTokenData
- type TwitterIdProvider
- type TwitterUserInfo
- type UserInfo
- type WeChatIdProvider
- type WeChatMiniProgramIdProvider
- type WeChatMiniProgramSessionResponse
- type WeComIdProvider
- type WeComInternalIdProvider
- type WeComProviderToken
- type WeComUserInfo
- type Web3AuthToken
- type Web3OnboardIdProvider
- type WechatAccessToken
- type WechatCacheMapValue
- type WechatUserInfo
- type WecomInterToken
- type WecomInternalUserInfo
- type WecomInternalUserResp
- type WeiBoIdProvider
- type WeiboAccessToken
- type WeiboUserinfo
Constants ¶
const GoogleIdTokenKey = "GoogleIdToken"
const Web3AuthTokenKey = "web3AuthToken"
Variables ¶
var ( WechatCacheMap map[string]WechatCacheMapValue Lock sync.RWMutex )
Functions ¶
func BuildWechatOpenIdKey ¶
Types ¶
type AdfsIdProvider ¶
func NewAdfsIdProvider ¶
func NewAdfsIdProvider(clientId string, clientSecret string, redirectUrl string, hostUrl string) *AdfsIdProvider
func (*AdfsIdProvider) GetToken ¶
func (idp *AdfsIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken get more detail via: https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/overview/ad-fs-openid-connect-oauth-flows-scenarios#request-an-access-token
func (*AdfsIdProvider) GetUserInfo ¶
func (idp *AdfsIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo Since the userinfo endpoint of ADFS only returns sub, the id_token is used to resolve the userinfo
func (*AdfsIdProvider) SetHttpClient ¶
func (idp *AdfsIdProvider) SetHttpClient(client *http.Client)
type AlipayAccessToken ¶
type AlipayAccessToken struct { Response AlipaySystemOauthTokenResponse `json:"alipay_system_oauth_token_response"` Sign string `json:"sign"` }
type AlipayIdProvider ¶
func NewAlipayIdProvider ¶
func NewAlipayIdProvider(clientId string, clientSecret string, redirectUrl string) *AlipayIdProvider
NewAlipayIdProvider ...
func (*AlipayIdProvider) GetToken ¶
func (idp *AlipayIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code to get access_token
func (*AlipayIdProvider) GetUserInfo ¶
func (idp *AlipayIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo Use access_token to get UserInfo
func (*AlipayIdProvider) SetHttpClient ¶
func (idp *AlipayIdProvider) SetHttpClient(client *http.Client)
SetHttpClient ...
type AlipayUserInfoShareResponse ¶
type AlipayUserInfoShareResponse struct {}
type AlipayUserResponse ¶
type AlipayUserResponse struct { Sign string `json:"sign"` }
type AzureADB2CProvider ¶
type AzureADB2CProvider struct { Client *http.Client Config *oauth2.Config Tenant string UserFlow string }
func NewAzureAdB2cProvider ¶
func NewAzureAdB2cProvider(clientId, clientSecret, redirectUrl, tenant string, userFlow string) *AzureADB2CProvider
func (*AzureADB2CProvider) GetToken ¶
func (p *AzureADB2CProvider) GetToken(code string) (*oauth2.Token, error)
func (*AzureADB2CProvider) GetUserInfo ¶
func (p *AzureADB2CProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*AzureADB2CProvider) SetHttpClient ¶
func (p *AzureADB2CProvider) SetHttpClient(client *http.Client)
type AzureadB2cToken ¶
type BaiduIdProvider ¶
func NewBaiduIdProvider ¶
func NewBaiduIdProvider(clientId string, clientSecret string, redirectUrl string) *BaiduIdProvider
func (*BaiduIdProvider) GetToken ¶
func (idp *BaiduIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*BaiduIdProvider) GetUserInfo ¶
func (idp *BaiduIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*BaiduIdProvider) SetHttpClient ¶
func (idp *BaiduIdProvider) SetHttpClient(client *http.Client)
type BaiduUserInfo ¶
type BilibiliIdProvider ¶
func NewBilibiliIdProvider ¶
func NewBilibiliIdProvider(clientId string, clientSecret string, redirectUrl string) *BilibiliIdProvider
func (*BilibiliIdProvider) GetToken ¶
func (idp *BilibiliIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken
{ "code": 0, "message": "0", "ttl": 1, "data": { "access_token": "d30bedaa4d8eb3128cf35ddc1030e27d", "expires_in": 1630220614, "refresh_token": "WxFDKwqScZIQDm4iWmKDvetyFugM6HkX" } }
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://openhome.bilibili.com/doc/4/eaf0e2b5-bde9-b9a0-9be1-019bb455701c
func (*BilibiliIdProvider) GetUserInfo ¶
func (idp *BilibiliIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo Use access_token to get UserInfo get more detail via: https://openhome.bilibili.com/doc/4/feb66f99-7d87-c206-00e7-d84164cd701c
func (*BilibiliIdProvider) SetHttpClient ¶
func (idp *BilibiliIdProvider) SetHttpClient(client *http.Client)
type BilibiliIdProviderTokenResponse ¶
type BilibiliIdProviderTokenResponse struct { Code int `json:"code"` Message string `json:"message"` TTL int `json:"ttl"` Data BilibiliProviderToken `json:"data"` }
type BilibiliProviderToken ¶
type BilibiliUserInfo ¶
type BilibiliUserInfoResponse ¶
type BilibiliUserInfoResponse struct { Code int `json:"code"` Message string `json:"message"` TTL int `json:"ttl"` Data BilibiliUserInfo `json:"data"` }
type CasdoorIdProvider ¶
func NewCasdoorIdProvider ¶
func NewCasdoorIdProvider(clientId string, clientSecret string, redirectUrl string, hostUrl string) *CasdoorIdProvider
func (*CasdoorIdProvider) GetToken ¶
func (idp *CasdoorIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*CasdoorIdProvider) GetUserInfo ¶
func (idp *CasdoorIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*CasdoorIdProvider) SetHttpClient ¶
func (idp *CasdoorIdProvider) SetHttpClient(client *http.Client)
type CasdoorToken ¶
type CasdoorUserInfo ¶
type CustomIdProvider ¶
type CustomIdProvider struct { Client *http.Client Config *oauth2.Config UserInfoURL string TokenURL string AuthURL string UserMapping map[string]string Scopes []string }
func NewCustomIdProvider ¶
func NewCustomIdProvider(idpInfo *ProviderInfo, redirectUrl string) *CustomIdProvider
func (*CustomIdProvider) GetToken ¶
func (idp *CustomIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*CustomIdProvider) GetUserInfo ¶
func (idp *CustomIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*CustomIdProvider) SetHttpClient ¶
func (idp *CustomIdProvider) SetHttpClient(client *http.Client)
type CustomUserInfo ¶
type DingTalkAccessToken ¶
type DingTalkIdProvider ¶
func NewDingTalkIdProvider ¶
func NewDingTalkIdProvider(clientId string, clientSecret string, redirectUrl string) *DingTalkIdProvider
NewDingTalkIdProvider ...
func (*DingTalkIdProvider) GetToken ¶
func (idp *DingTalkIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting authCode ought to be done in front) get more detail via: https://open.dingtalk.com/document/orgapp-server/obtain-user-token
func (*DingTalkIdProvider) GetUserInfo ¶
func (idp *DingTalkIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo Use access_token to get UserInfo get more detail via: https://open.dingtalk.com/document/orgapp-server/dingtalk-retrieve-user-information
func (*DingTalkIdProvider) SetHttpClient ¶
func (idp *DingTalkIdProvider) SetHttpClient(client *http.Client)
SetHttpClient ...
type DingTalkUserResponse ¶
type DouyinIdProvider ¶
func NewDouyinIdProvider ¶
func NewDouyinIdProvider(clientId string, clientSecret string, redirectUrl string) *DouyinIdProvider
func (*DouyinIdProvider) GetToken ¶
func (idp *DouyinIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code to get access_token get more details via: https://open.douyin.com/platform/doc?doc=docs/openapi/account-permission/get-access-token
func (*DouyinIdProvider) GetUserInfo ¶
func (idp *DouyinIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use token to get user profile
func (*DouyinIdProvider) SetHttpClient ¶
func (idp *DouyinIdProvider) SetHttpClient(client *http.Client)
type DouyinTokenResp ¶
type DouyinUserInfo ¶
type DouyinUserInfo struct { Data struct { Avatar string `json:"avatar"` City string `json:"city"` Country string `json:"country"` // 0->unknown, 1->male, 2->female Gender int64 `json:"gender"` Nickname string `json:"nickname"` OpenId string `json:"open_id"` Province string `json:"province"` } `json:"data"` }
type FacebookAccessToken ¶
type FacebookCheckToken ¶
type FacebookCheckToken struct {
Data string `json:"data"`
}
type FacebookCheckTokenData ¶
type FacebookCheckTokenData struct {
UserId string `json:"user_id"`
}
FacebookCheckTokenData Get more detail via: https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow#checktoken
type FacebookIdProvider ¶
func NewFacebookIdProvider ¶
func NewFacebookIdProvider(clientId string, clientSecret string, redirectUrl string) *FacebookIdProvider
func (*FacebookIdProvider) GetToken ¶
func (idp *FacebookIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow#confirm
func (*FacebookIdProvider) GetUrlResp ¶
func (idp *FacebookIdProvider) GetUrlResp(url string) (string, error)
func (*FacebookIdProvider) GetUserInfo ¶
func (idp *FacebookIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use FacebookAccessToken gotten before return FacebookUserInfo get more detail via: https://developers.facebook.com/docs/graph-api/reference/user
func (*FacebookIdProvider) SetHttpClient ¶
func (idp *FacebookIdProvider) SetHttpClient(client *http.Client)
type FacebookUserInfo ¶
type FacebookUserInfo struct { Id string `json:"id"` // The app user's App-Scoped User ID. This ID is unique to the app and cannot be used by other apps. Name string `json:"name"` // The person's full name. NameFormat string `json:"name_format"` // The person's name formatted to correctly handle Chinese, Japanese, or Korean ordering. Picture struct { Data struct { Height int `json:"height"` IsSilhouette bool `json:"is_silhouette"` Url string `json:"url"` Width int `json:"width"` } `json:"data"` } `json:"picture"` Email string `json:"email"` // The User's primary email address listed on their profile. This field will not be returned if no valid email address is available. }
type GitHubUserInfo ¶
type GitHubUserInfo struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` Name string `json:"name"` Company string `json:"company"` Blog string `json:"blog"` Location string `json:"location"` Email string `json:"email"` Hireable bool `json:"hireable"` Bio string `json:"bio"` TwitterUsername interface{} `json:"twitter_username"` PublicRepos int `json:"public_repos"` PublicGists int `json:"public_gists"` Followers int `json:"followers"` Following int `json:"following"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` PrivateGists int `json:"private_gists"` TotalPrivateRepos int `json:"total_private_repos"` OwnedPrivateRepos int `json:"owned_private_repos"` DiskUsage int `json:"disk_usage"` Collaborators int `json:"collaborators"` TwoFactorAuthentication bool `json:"two_factor_authentication"` Plan struct { Name string `json:"name"` Space int `json:"space"` Collaborators int `json:"collaborators"` PrivateRepos int `json:"private_repos"` } `json:"plan"` }
type GiteeAccessToken ¶
type GiteeIdProvider ¶
func NewGiteeIdProvider ¶
func NewGiteeIdProvider(clientId string, clientSecret string, redirectUrl string) *GiteeIdProvider
func (*GiteeIdProvider) GetToken ¶
func (idp *GiteeIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) The POST Url format of submission is: https://gitee.com/oauth/token?grant_type=authorization_code&code={code}&client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret} get more detail via: https://gitee.com/api/v5/oauth_doc#/
func (*GiteeIdProvider) GetUrlResp ¶
func (idp *GiteeIdProvider) GetUrlResp(url string) (string, error)
func (*GiteeIdProvider) GetUserInfo ¶
func (idp *GiteeIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo Use userid and access_token to get UserInfo get more detail via: https://gitee.com/api/v5/swagger#/getV5User
func (*GiteeIdProvider) SetHttpClient ¶
func (idp *GiteeIdProvider) SetHttpClient(client *http.Client)
type GiteeUserResponse ¶
type GiteeUserResponse struct { AvatarUrl string `json:"avatar_url"` Bio string `json:"bio"` Blog string `json:"blog"` CreatedAt string `json:"created_at"` Email string `json:"email"` EventsUrl string `json:"events_url"` Followers int `json:"followers"` FollowersUrl string `json:"followers_url"` Following int `json:"following"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` HtmlUrl string `json:"html_url"` Id int `json:"id"` Login string `json:"login"` MemberRole string `json:"member_role"` Name string `json:"name"` OrganizationsUrl string `json:"organizations_url"` PublicGists int `json:"public_gists"` PublicRepos int `json:"public_repos"` ReceivedEventsUrl string `json:"received_events_url"` ReposUrl string `json:"repos_url"` Stared int `json:"stared"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` Type string `json:"type"` UpdatedAt string `json:"updated_at"` Url string `json:"url"` Watched int `json:"watched"` Weibo string `json:"weibo"` }
type GithubIdProvider ¶
func NewGithubIdProvider ¶
func NewGithubIdProvider(clientId string, clientSecret string, redirectUrl string) *GithubIdProvider
func (*GithubIdProvider) GetToken ¶
func (idp *GithubIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*GithubIdProvider) GetUserInfo ¶
func (idp *GithubIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*GithubIdProvider) SetHttpClient ¶
func (idp *GithubIdProvider) SetHttpClient(client *http.Client)
type GithubToken ¶
type GitlabIdProvider ¶
func NewGitlabIdProvider ¶
func NewGitlabIdProvider(clientId string, clientSecret string, redirectUrl string) *GitlabIdProvider
func (*GitlabIdProvider) GetToken ¶
func (idp *GitlabIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://docs.gitlab.com/ee/api/oauth2.html
func (*GitlabIdProvider) GetUserInfo ¶
func (idp *GitlabIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use GitlabProviderToken gotten before return GitlabUserInfo
func (*GitlabIdProvider) SetHttpClient ¶
func (idp *GitlabIdProvider) SetHttpClient(client *http.Client)
type GitlabProviderToken ¶
type GitlabUserInfo ¶
type GitlabUserInfo struct { Id int `json:"id"` Name string `json:"name"` Username string `json:"username"` State string `json:"state"` AvatarUrl string `json:"avatar_url"` WebUrl string `json:"web_url"` CreatedAt time.Time `json:"created_at"` Bio string `json:"bio"` BioHtml string `json:"bio_html"` Location string `json:"location"` PublicEmail string `json:"public_email"` Skype string `json:"skype"` Linkedin string `json:"linkedin"` Twitter string `json:"twitter"` WebsiteUrl string `json:"website_url"` Organization string `json:"organization"` JobTitle string `json:"job_title"` Pronouns interface{} `json:"pronouns"` Bot bool `json:"bot"` WorkInformation interface{} `json:"work_information"` Followers int `json:"followers"` Following int `json:"following"` LastSignInAt time.Time `json:"last_sign_in_at"` ConfirmedAt time.Time `json:"confirmed_at"` LastActivityOn string `json:"last_activity_on"` Email string `json:"email"` ThemeId int `json:"theme_id"` ColorSchemeId int `json:"color_scheme_id"` ProjectsLimit int `json:"projects_limit"` CurrentSignInAt time.Time `json:"current_sign_in_at"` Identities []struct { Provider string `json:"provider"` ExternUid string `json:"extern_uid"` SamlProviderId interface{} `json:"saml_provider_id"` } `json:"identities"` CanCreateGroup bool `json:"can_create_group"` CanCreateProject bool `json:"can_create_project"` TwoFactorEnabled bool `json:"two_factor_enabled"` External bool `json:"external"` PrivateProfile bool `json:"private_profile"` CommitEmail string `json:"commit_email"` }
type GoogleIdProvider ¶
func NewGoogleIdProvider ¶
func NewGoogleIdProvider(clientId string, clientSecret string, redirectUrl string) *GoogleIdProvider
func (*GoogleIdProvider) GetToken ¶
func (idp *GoogleIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*GoogleIdProvider) GetUserInfo ¶
func (idp *GoogleIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*GoogleIdProvider) SetHttpClient ¶
func (idp *GoogleIdProvider) SetHttpClient(client *http.Client)
type GoogleIdToken ¶
type GoogleIdToken struct { // These six fields are included in all Google ID Tokens. Iss string `json:"iss"` // The issuer, or signer, of the token. For Google-signed ID tokens, this value is https://accounts.google.com. Sub string `json:"sub"` // The subject: the ID that represents the principal making the request. Azp string `json:"azp"` // Optional. Who the token was issued to. Here is the ClientID Aud string `json:"aud"` // The audience of the token. Here is the ClientID Iat string `json:"iat"` // Unix epoch time when the token was issued. Exp string `json:"exp"` // Unix epoch time when the token expires. // These seven fields are only included when the user has granted the "profile" and "email" OAuth scopes to the application. Email string `json:"email"` EmailVerified string `json:"email_verified"` Name string `json:"name"` Picture string `json:"picture"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` Locale string `json:"locale"` }
https://developers.google.com/identity/sign-in/web/backend-auth#calling-the-tokeninfo-endpoint
type GooglePeopleApiPhoneNumber ¶
type GooglePeopleApiPhoneNumber struct { CanonicalForm string `json:"canonicalForm"` MetaData GooglePeopleApiPhoneNumberMetaData `json:"metadata"` Value string `json:"value"` Type string `json:"type"` }
type GooglePeopleApiPhoneNumberMetaData ¶
type GooglePeopleApiPhoneNumberMetaData struct {
Primary bool `json:"primary"`
}
type GooglePeopleApiResult ¶
type GooglePeopleApiResult struct { PhoneNumbers []GooglePeopleApiPhoneNumber `json:"phoneNumbers"` Etag string `json:"etag"` ResourceName string `json:"resourceName"` }
type GoogleUserInfo ¶
type GothIdProvider ¶
func NewGothIdProvider ¶
func (*GothIdProvider) GetToken ¶
func (idp *GothIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*GothIdProvider) GetUserInfo ¶
func (idp *GothIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*GothIdProvider) SetHttpClient ¶
func (idp *GothIdProvider) SetHttpClient(client *http.Client)
SetHttpClient Goth's idp all implement the Client method, but since the goth.Provider interface does not provide to modify idp's client method, reflection is required
type IdProvider ¶
type IdProvider interface { SetHttpClient(client *http.Client) GetToken(code string) (*oauth2.Token, error) GetUserInfo(token *oauth2.Token) (*UserInfo, error) }
func GetIdProvider ¶
func GetIdProvider(idpInfo *ProviderInfo, redirectUrl string) (IdProvider, error)
type InfoflowIdProvider ¶
type InfoflowIdProvider struct { Client *http.Client Config *oauth2.Config AgentId string Ticket string }
func NewInfoflowIdProvider ¶
func NewInfoflowIdProvider(clientId string, clientSecret string, appId string, redirectUrl string) *InfoflowIdProvider
func (*InfoflowIdProvider) GetToken ¶
func (idp *InfoflowIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken get more detail via: https://qy.baidu.com/doc/index.html#/third_serverapi/authority
func (*InfoflowIdProvider) GetUserInfo ¶
func (idp *InfoflowIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo get more detail via: https://qy.baidu.com/doc/index.html#/third_serverapi/contacts?id=%e8%8e%b7%e5%8f%96%e6%88%90%e5%91%98
func (*InfoflowIdProvider) SetHttpClient ¶
func (idp *InfoflowIdProvider) SetHttpClient(client *http.Client)
type InfoflowInterToken ¶
type InfoflowInternalIdProvider ¶
func NewInfoflowInternalIdProvider ¶
func NewInfoflowInternalIdProvider(clientId string, clientSecret string, appId string, redirectUrl string) *InfoflowInternalIdProvider
func (*InfoflowInternalIdProvider) GetToken ¶
func (idp *InfoflowInternalIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken get more detail via: https://qy.baidu.com/doc/index.html#/inner_quickstart/flow?id=%E8%8E%B7%E5%8F%96accesstoken
func (*InfoflowInternalIdProvider) GetUserInfo ¶
func (idp *InfoflowInternalIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo get more detail via: https://qy.baidu.com/doc/index.html#/inner_serverapi/contacts?id=%e8%8e%b7%e5%8f%96%e6%88%90%e5%91%98
func (*InfoflowInternalIdProvider) SetHttpClient ¶
func (idp *InfoflowInternalIdProvider) SetHttpClient(client *http.Client)
type InfoflowToken ¶
type InfoflowUserInfo ¶
type InfoflowUserResp ¶
type LarkAccessToken ¶
type LarkIdProvider ¶
func NewLarkIdProvider ¶
func NewLarkIdProvider(clientId string, clientSecret string, redirectUrl string) *LarkIdProvider
func (*LarkIdProvider) GetToken ¶
func (idp *LarkIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://docs.microsoft.com/en-us/linkedIn/shared/authentication/authorization-code-flow?context=linkedIn%2Fcontext&tabs=HTTPS
func (*LarkIdProvider) GetUserInfo ¶
func (idp *LarkIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use LarkAccessToken gotten before return LinkedInUserInfo get more detail via: https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin?context=linkedin/consumer/context
func (*LarkIdProvider) SetHttpClient ¶
func (idp *LarkIdProvider) SetHttpClient(client *http.Client)
type LarkUserInfo ¶
type LarkUserInfo struct { Code int `json:"code"` Msg string `json:"msg"` Data struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` Name string `json:"name"` EnName string `json:"en_name"` AvatarUrl string `json:"avatar_url"` AvatarThumb string `json:"avatar_thumb"` AvatarMiddle string `json:"avatar_middle"` AvatarBig string `json:"avatar_big"` OpenId string `json:"open_id"` UnionId string `json:"union_id"` Email string `json:"email"` UserId string `json:"user_id"` Mobile string `json:"mobile"` TenantKey string `json:"tenant_key"` RefreshExpiresIn int `json:"refresh_expires_in"` RefreshToken string `json:"refresh_token"` } `json:"data"` }
type LinkedInAccessToken ¶
type LinkedInIdProvider ¶
func NewLinkedInIdProvider ¶
func NewLinkedInIdProvider(clientId string, clientSecret string, redirectUrl string) *LinkedInIdProvider
func (*LinkedInIdProvider) GetToken ¶
func (idp *LinkedInIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://docs.microsoft.com/en-us/linkedIn/shared/authentication/authorization-code-flow?context=linkedIn%2Fcontext&tabs=HTTPS
func (*LinkedInIdProvider) GetUrlRespWithAuthorization ¶
func (idp *LinkedInIdProvider) GetUrlRespWithAuthorization(url, token string) ([]byte, error)
func (*LinkedInIdProvider) GetUserInfo ¶
func (idp *LinkedInIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use LinkedInAccessToken gotten before return LinkedInUserInfo get more detail via: https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin?context=linkedin/consumer/context
func (*LinkedInIdProvider) SetHttpClient ¶
func (idp *LinkedInIdProvider) SetHttpClient(client *http.Client)
type LinkedInUserEmail ¶
type LinkedInUserInfo ¶
type LinkedInUserInfo struct { FirstName struct { Localized map[string]string `json:"localized"` PreferredLocale struct { Country string `json:"country"` Language string `json:"language"` } `json:"preferredLocale"` } `json:"firstName"` LastName struct { Localized map[string]string `json:"localized"` PreferredLocale struct { Country string `json:"country"` Language string `json:"language"` } `json:"preferredLocale"` } `json:"lastName"` ProfilePicture struct { DisplayImage string `json:"displayImage"` DisplayImage1 struct { Paging struct { Count int `json:"count"` Start int `json:"start"` Links []interface{} `json:"links"` } `json:"paging"` Elements []struct { Artifact string `json:"artifact"` AuthorizationMethod string `json:"authorizationMethod"` Data struct { ComLinkedinDigitalmediaMediaartifactStillImage struct { MediaType string `json:"mediaType"` RawCodecSpec struct { Name string `json:"name"` Type string `json:"type"` } `json:"rawCodecSpec"` DisplaySize struct { Width float64 `json:"width"` Uom string `json:"uom"` Height float64 `json:"height"` } `json:"displaySize"` StorageSize struct { Width int `json:"width"` Height int `json:"height"` } `json:"storageSize"` StorageAspectRatio struct { WidthAspect float64 `json:"widthAspect"` HeightAspect float64 `json:"heightAspect"` Formatted string `json:"formatted"` } `json:"storageAspectRatio"` DisplayAspectRatio struct { WidthAspect float64 `json:"widthAspect"` HeightAspect float64 `json:"heightAspect"` Formatted string `json:"formatted"` } `json:"displayAspectRatio"` } `json:"com.linkedin.digitalmedia.mediaartifact.StillImage"` } `json:"data"` Identifiers []struct { Identifier string `json:"identifier"` Index int `json:"index"` MediaType string `json:"mediaType"` File string `json:"file"` IdentifierType string `json:"identifierType"` IdentifierExpiresInSeconds int `json:"identifierExpiresInSeconds"` } `json:"identifiers"` } `json:"elements"` } `json:"displayImage~"` } `json:"profilePicture"` Id string `json:"id"` }
type MetaMaskIdProvider ¶
func NewMetaMaskIdProvider ¶
func NewMetaMaskIdProvider() *MetaMaskIdProvider
func (*MetaMaskIdProvider) GetToken ¶
func (idp *MetaMaskIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*MetaMaskIdProvider) GetUserInfo ¶
func (idp *MetaMaskIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*MetaMaskIdProvider) SetHttpClient ¶
func (idp *MetaMaskIdProvider) SetHttpClient(client *http.Client)
type OktaIdProvider ¶
func NewOktaIdProvider ¶
func NewOktaIdProvider(clientId string, clientSecret string, redirectUrl string, hostUrl string) *OktaIdProvider
func (*OktaIdProvider) GetToken ¶
func (idp *OktaIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code to get access_token get more details via: https://developer.okta.com/docs/reference/api/oidc/#token
func (*OktaIdProvider) GetUserInfo ¶
func (idp *OktaIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use token to get user profile get more details via: https://developer.okta.com/docs/reference/api/oidc/#userinfo
func (*OktaIdProvider) SetHttpClient ¶
func (idp *OktaIdProvider) SetHttpClient(client *http.Client)
type OktaUserInfo ¶
type ProviderInfo ¶
type QqIdProvider ¶
func NewQqIdProvider ¶
func NewQqIdProvider(clientId string, clientSecret string, redirectUrl string) *QqIdProvider
func (*QqIdProvider) GetToken ¶
func (idp *QqIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*QqIdProvider) GetUserInfo ¶
func (idp *QqIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*QqIdProvider) SetHttpClient ¶
func (idp *QqIdProvider) SetHttpClient(client *http.Client)
type QqUserInfo ¶
type QqUserInfo struct { Ret int `json:"ret"` Msg string `json:"msg"` IsLost int `json:"is_lost"` Nickname string `json:"nickname"` Gender string `json:"gender"` GenderType int `json:"gender_type"` Province string `json:"province"` City string `json:"city"` Year string `json:"year"` Constellation string `json:"constellation"` Figureurl string `json:"figureurl"` Figureurl1 string `json:"figureurl_1"` Figureurl2 string `json:"figureurl_2"` FigureurlQq1 string `json:"figureurl_qq_1"` FigureurlQq2 string `json:"figureurl_qq_2"` FigureurlQq string `json:"figureurl_qq"` FigureurlType string `json:"figureurl_type"` IsYellowVip string `json:"is_yellow_vip"` Vip string `json:"vip"` YellowVipLevel string `json:"yellow_vip_level"` Level string `json:"level"` IsYellowYearVip string `json:"is_yellow_year_vip"` }
type TwitterAccessToken ¶
type TwitterCheckToken ¶
type TwitterCheckToken struct {
Data TwitterUserInfo `json:"data"`
}
type TwitterCheckTokenData ¶
type TwitterCheckTokenData struct {
UserId string `json:"user_id"`
}
TwitterCheckTokenData Get more detail via: https://developers.Twitter.com/docs/Twitter-login/guides/advanced/manual-flow#checktoken
type TwitterIdProvider ¶
func NewTwitterIdProvider ¶
func NewTwitterIdProvider(clientId string, clientSecret string, redirectUrl string) *TwitterIdProvider
func (*TwitterIdProvider) GetToken ¶
func (idp *TwitterIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://developers.Twitter.com/docs/Twitter-login/guides/advanced/manual-flow#confirm
func (*TwitterIdProvider) GetUrlResp ¶
func (idp *TwitterIdProvider) GetUrlResp(url *http.Request) (string, error)
func (*TwitterIdProvider) GetUserInfo ¶
func (idp *TwitterIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use TwitterAccessToken gotten before return TwitterUserInfo get more detail via: https://developers.Twitter.com/docs/graph-api/reference/user
func (*TwitterIdProvider) SetHttpClient ¶
func (idp *TwitterIdProvider) SetHttpClient(client *http.Client)
type TwitterUserInfo ¶
type TwitterUserInfo struct { Id string `json:"id"` // The app user's App-Scoped User ID. This ID is unique to the app and cannot be used by other apps. Name string `json:"name"` // The person's full name. UserName string `json:"username"` // The person's name formatted to correctly handle Chinese, Japanese, or Korean ordering. Picture struct { Data struct { Height int `json:"height"` IsSilhouette bool `json:"is_silhouette"` Url string `json:"url"` Width int `json:"width"` } `json:"data"` } `json:"picture"` Email string `json:"email"` // The User's primary email address listed on their profile. This field will not be returned if no valid email address is available. }
type WeChatIdProvider ¶
func NewWeChatIdProvider ¶
func NewWeChatIdProvider(clientId string, clientSecret string, redirectUrl string) *WeChatIdProvider
func (*WeChatIdProvider) GetToken ¶
func (idp *WeChatIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
func (*WeChatIdProvider) GetUserInfo ¶
func (idp *WeChatIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use WechatAccessToken gotten before return WechatUserInfo get more detail via: https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Authorized_Interface_Calling_UnionID.html
func (*WeChatIdProvider) SetHttpClient ¶
func (idp *WeChatIdProvider) SetHttpClient(client *http.Client)
type WeChatMiniProgramIdProvider ¶
func NewWeChatMiniProgramIdProvider ¶
func NewWeChatMiniProgramIdProvider(clientId string, clientSecret string) *WeChatMiniProgramIdProvider
func (*WeChatMiniProgramIdProvider) GetSessionByCode ¶
func (idp *WeChatMiniProgramIdProvider) GetSessionByCode(code string) (*WeChatMiniProgramSessionResponse, error)
func (*WeChatMiniProgramIdProvider) SetHttpClient ¶
func (idp *WeChatMiniProgramIdProvider) SetHttpClient(client *http.Client)
type WeComIdProvider ¶
func NewWeComIdProvider ¶
func NewWeComIdProvider(clientId string, clientSecret string, redirectUrl string) *WeComIdProvider
func (*WeComIdProvider) GetToken ¶
func (idp *WeComIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
func (*WeComIdProvider) GetUserInfo ¶
func (idp *WeComIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use WeComProviderToken gotten before return WeComUserInfo get more detail via: https://work.weixin.qq.com/api/doc/90001/90143/91125
func (*WeComIdProvider) SetHttpClient ¶
func (idp *WeComIdProvider) SetHttpClient(client *http.Client)
type WeComInternalIdProvider ¶
WeComInternalIdProvider This idp is using wecom internal application api as idp
func NewWeComInternalIdProvider ¶
func NewWeComInternalIdProvider(clientId string, clientSecret string, redirectUrl string) *WeComInternalIdProvider
func (*WeComInternalIdProvider) GetToken ¶
func (idp *WeComInternalIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://developer.work.weixin.qq.com/document/path/91039
func (*WeComInternalIdProvider) GetUserInfo ¶
func (idp *WeComInternalIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*WeComInternalIdProvider) SetHttpClient ¶
func (idp *WeComInternalIdProvider) SetHttpClient(client *http.Client)
type WeComProviderToken ¶
type WeComUserInfo ¶
type WeComUserInfo struct { Errcode int `json:"errcode"` Errmsg string `json:"errmsg"` Usertype int `json:"usertype"` UserInfo struct { Userid string `json:"userid"` OpenUserid string `json:"open_userid"` Name string `json:"name"` Avatar string `json:"avatar"` } `json:"user_info"` CorpInfo struct { Corpid string `json:"corpid"` } `json:"corp_info"` Agent []struct { Agentid int `json:"agentid"` AuthType int `json:"auth_type"` } `json:"agent"` AuthInfo struct { Department []struct { Id int `json:"id"` Writable bool `json:"writable"` } `json:"department"` } `json:"auth_info"` }
type Web3AuthToken ¶
type Web3AuthToken struct { Address string `json:"address"` Nonce string `json:"nonce"` CreateAt uint64 `json:"createAt"` TypedData string `json:"typedData"` // typed data use for application Signature string `json:"signature"` // signature for typed data WalletType string `json:"walletType"` // e.g."MetaMask", "Coinbase" }
type Web3OnboardIdProvider ¶
func NewWeb3OnboardIdProvider ¶
func NewWeb3OnboardIdProvider() *Web3OnboardIdProvider
func (*Web3OnboardIdProvider) GetToken ¶
func (idp *Web3OnboardIdProvider) GetToken(code string) (*oauth2.Token, error)
func (*Web3OnboardIdProvider) GetUserInfo ¶
func (idp *Web3OnboardIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
func (*Web3OnboardIdProvider) SetHttpClient ¶
func (idp *Web3OnboardIdProvider) SetHttpClient(client *http.Client)
type WechatAccessToken ¶
type WechatAccessToken struct { AccessToken string `json:"access_token"` // Interface call credentials ExpiresIn int64 `json:"expires_in"` // access_token interface call credential timeout time, unit (seconds) RefreshToken string `json:"refresh_token"` // User refresh access_token Openid string `json:"openid"` // Unique ID of authorized user Scope string `json:"scope"` // The scope of user authorization, separated by commas. (,) Unionid string `json:"unionid"` // This field will appear if and only if the website application has been authorized by the user's UserInfo. }
type WechatCacheMapValue ¶
type WechatUserInfo ¶
type WechatUserInfo struct { Openid string `json:"openid"` // The ID of an ordinary user, which is unique to the current developer account Nickname string `json:"nickname"` // Ordinary user nickname Sex int `json:"sex"` // Ordinary user gender, 1 is male, 2 is female Language string `json:"language"` City string `json:"city"` // City filled in by general user's personal data Province string `json:"province"` // Province filled in by ordinary user's personal information Country string `json:"country"` // Country, such as China is CN Headimgurl string `json:"headimgurl"` // User avatar, the last value represents the size of the square avatar (there are optional values of 0, 46, 64, 96, 132, 0 represents a 640*640 square avatar), this item is empty when the user does not have an avatar Privilege []string `json:"privilege"` // User Privilege information, json array, such as Wechat Woka user (chinaunicom) Unionid string `json:"unionid"` // Unified user identification. For an application under a WeChat open platform account, the unionid of the same user is unique. }
type WecomInterToken ¶
type WecomInternalUserInfo ¶
type WecomInternalUserResp ¶
type WeiBoIdProvider ¶
func NewWeiBoIdProvider ¶
func NewWeiBoIdProvider(clientId string, clientSecret string, redirectUrl string) *WeiBoIdProvider
func (*WeiBoIdProvider) GetToken ¶
func (idp *WeiBoIdProvider) GetToken(code string) (*oauth2.Token, error)
GetToken use code get access_token (*operation of getting code ought to be done in front) get more detail via: https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
func (*WeiBoIdProvider) GetUrlResp ¶
func (idp *WeiBoIdProvider) GetUrlResp(url string) (string, error)
func (*WeiBoIdProvider) GetUserInfo ¶
func (idp *WeiBoIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
GetUserInfo use WeiboAccessToken gotten before return UserInfo get more detail via: https://open.weibo.com/wiki/2/users/show
func (*WeiBoIdProvider) SetHttpClient ¶
func (idp *WeiBoIdProvider) SetHttpClient(client *http.Client)
type WeiboAccessToken ¶
type WeiboUserinfo ¶
type WeiboUserinfo struct { Id int `json:"id"` ScreenName string `json:"screen_name"` Name string `json:"name"` Province string `json:"province"` City string `json:"city"` Location string `json:"location"` Description string `json:"description"` Url string `json:"url"` ProfileImageUrl string `json:"profile_image_url"` Domain string `json:"domain"` Gender string `json:"gender"` FollowersCount int `json:"followers_count"` FriendsCount int `json:"friends_count"` StatusesCount int `json:"statuses_count"` FavouritesCount int `json:"favourites_count"` CreatedAt string `json:"created_at"` Following bool `json:"following"` AllowAllActMsg bool `json:"allow_all_act_msg"` GeoEnabled bool `json:"geo_enabled"` Verified bool `json:"verified"` Status struct { CreatedAt string `json:"created_at"` Id int64 `json:"id"` Text string `json:"text"` Source string `json:"source"` Favorited bool `json:"favorited"` Truncated bool `json:"truncated"` InReplyToStatusId string `json:"in_reply_to_status_id"` InReplyToUserId string `json:"in_reply_to_user_id"` InReplyToScreenName string `json:"in_reply_to_screen_name"` Geo interface{} `json:"geo"` Mid string `json:"mid"` Annotations []interface{} `json:"annotations"` RepostsCount int `json:"reposts_count"` CommentsCount int `json:"comments_count"` } `json:"status"` AllowAllComment bool `json:"allow_all_comment"` AvatarLarge string `json:"avatar_large"` VerifiedReason string `json:"verified_reason"` FollowMe bool `json:"follow_me"` OnlineStatus int `json:"online_status"` BiFollowersCount int `json:"bi_followers_count"` }
Source Files ¶
- adfs.go
- alipay.go
- azuread_b2c.go
- baidu.go
- bilibili.go
- casdoor.go
- custom.go
- dingtalk.go
- douyin.go
- facebook.go
- gitee.go
- github.go
- gitlab.go
- google.go
- goth.go
- infoflow_internal.go
- infoflow_third_party.go
- lark.go
- linkedin.go
- metamask.go
- okta.go
- provider.go
- qq.go
- twitter.go
- web3onboard.go
- wechat.go
- wechat_miniprogram.go
- wecom_internal.go
- wecom_third_party.go
- weibo.go