idp

package
v1.707.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 93 Imported by: 2

Documentation

Index

Constants

View Source
const GoogleIdTokenKey = "GoogleIdToken"
View Source
const Web3AuthTokenKey = "web3AuthToken"

Variables

View Source
var (
	WechatCacheMap map[string]WechatCacheMapValue
	Lock           sync.RWMutex
)

Functions

func BuildWechatOpenIdKey added in v1.452.0

func BuildWechatOpenIdKey(appId string) string

func GetWechatOfficialAccountAccessToken added in v1.156.0

func GetWechatOfficialAccountAccessToken(clientId string, clientSecret string) (string, string, error)

func GetWechatOfficialAccountQRCode added in v1.156.0

func GetWechatOfficialAccountQRCode(clientId string, clientSecret string, providerId string) (string, string, error)

func VerifyWechatSignature added in v1.525.0

func VerifyWechatSignature(token string, nonce string, timestamp string, signature string) bool

Types

type AdfsIdProvider added in v1.20.0

type AdfsIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
	Host   string
}

func NewAdfsIdProvider added in v1.20.0

func NewAdfsIdProvider(clientId string, clientSecret string, redirectUrl string, hostUrl string) *AdfsIdProvider

func (*AdfsIdProvider) GetUserInfo added in v1.20.0

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 added in v1.20.0

func (idp *AdfsIdProvider) SetHttpClient(client *http.Client)

type AdfsToken added in v1.20.0

type AdfsToken struct {
	IdToken   string `json:"id_token"`
	ExpiresIn int    `json:"expires_in"`
	ErrMsg    string `json:"error_description"`
}

type AlipayAccessToken added in v1.35.0

type AlipayAccessToken struct {
	Response AlipaySystemOauthTokenResponse `json:"alipay_system_oauth_token_response"`
	Sign     string                         `json:"sign"`
}

type AlipayIdProvider added in v1.35.0

type AlipayIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

func NewAlipayIdProvider added in v1.35.0

func NewAlipayIdProvider(clientId string, clientSecret string, redirectUrl string) *AlipayIdProvider

NewAlipayIdProvider ...

func (*AlipayIdProvider) GetToken added in v1.35.0

func (idp *AlipayIdProvider) GetToken(code string) (*oauth2.Token, error)

GetToken use code to get access_token

func (*AlipayIdProvider) GetUserInfo added in v1.35.0

func (idp *AlipayIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

GetUserInfo Use access_token to get UserInfo

func (*AlipayIdProvider) SetHttpClient added in v1.35.0

func (idp *AlipayIdProvider) SetHttpClient(client *http.Client)

SetHttpClient ...

type AlipaySystemOauthTokenResponse added in v1.35.0

type AlipaySystemOauthTokenResponse struct {
	AccessToken  string `json:"access_token"`
	AlipayUserId string `json:"alipay_user_id"`
	ExpiresIn    int    `json:"expires_in"`
	ReExpiresIn  int    `json:"re_expires_in"`
	RefreshToken string `json:"refresh_token"`
	UserId       string `json:"user_id"`
}

type AlipayUserInfoShareResponse added in v1.35.0

type AlipayUserInfoShareResponse struct {
	Code     string `json:"code"`
	Msg      string `json:"msg"`
	Avatar   string `json:"avatar"`
	NickName string `json:"nick_name"`
	UserId   string `json:"user_id"`
}

type AlipayUserResponse added in v1.35.0

type AlipayUserResponse struct {
	AlipayUserInfoShareResponse AlipayUserInfoShareResponse `json:"alipay_user_info_share_response"`
	Sign                        string                      `json:"sign"`
}

type AzureADB2CProvider added in v1.477.0

type AzureADB2CProvider struct {
	Client   *http.Client
	Config   *oauth2.Config
	Tenant   string
	UserFlow string
}

func NewAzureAdB2cProvider added in v1.477.0

func NewAzureAdB2cProvider(clientId, clientSecret, redirectUrl, tenant string, userFlow string) *AzureADB2CProvider

func (*AzureADB2CProvider) GetToken added in v1.477.0

func (p *AzureADB2CProvider) GetToken(code string) (*oauth2.Token, error)

func (*AzureADB2CProvider) GetUserInfo added in v1.477.0

func (p *AzureADB2CProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

func (*AzureADB2CProvider) SetHttpClient added in v1.477.0

func (p *AzureADB2CProvider) SetHttpClient(client *http.Client)

type AzureadB2cToken added in v1.477.0

type AzureadB2cToken struct {
	IdToken          string `json:"id_token"`
	TokenType        string `json:"token_type"`
	NotBefore        int    `json:"not_before"`
	IdTokenExpiresIn int    `json:"id_token_expires_in"`
	ProfileInfo      string `json:"profile_info"`
	Scope            string `json:"scope"`
}

type BaiduIdProvider added in v1.12.0

type BaiduIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

func NewBaiduIdProvider added in v1.12.0

func NewBaiduIdProvider(clientId string, clientSecret string, redirectUrl string) *BaiduIdProvider

func (*BaiduIdProvider) GetToken added in v1.12.0

func (idp *BaiduIdProvider) GetToken(code string) (*oauth2.Token, error)

func (*BaiduIdProvider) GetUserInfo added in v1.12.0

func (idp *BaiduIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

func (*BaiduIdProvider) SetHttpClient added in v1.12.0

func (idp *BaiduIdProvider) SetHttpClient(client *http.Client)

type BaiduUserInfo added in v1.12.0

type BaiduUserInfo struct {
	OpenId   string `json:"openid"`
	Username string `json:"username"`
	Portrait string `json:"portrait"`
}

type BilibiliIdProvider added in v1.51.0

type BilibiliIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

func NewBilibiliIdProvider added in v1.51.0

func NewBilibiliIdProvider(clientId string, clientSecret string, redirectUrl string) *BilibiliIdProvider

func (*BilibiliIdProvider) GetToken added in v1.51.0

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 added in v1.51.0

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 added in v1.51.0

func (idp *BilibiliIdProvider) SetHttpClient(client *http.Client)

type BilibiliIdProviderTokenResponse added in v1.51.0

type BilibiliIdProviderTokenResponse struct {
	Code    int                   `json:"code"`
	Message string                `json:"message"`
	TTL     int                   `json:"ttl"`
	Data    BilibiliProviderToken `json:"data"`
}

type BilibiliProviderToken added in v1.51.0

type BilibiliProviderToken struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
}

type BilibiliUserInfo added in v1.51.0

type BilibiliUserInfo struct {
	Name   string `json:"name"`
	Face   string `json:"face"`
	OpenId string `json:"openid"`
}

type BilibiliUserInfoResponse added in v1.51.0

type BilibiliUserInfoResponse struct {
	Code    int              `json:"code"`
	Message string           `json:"message"`
	TTL     int              `json:"ttl"`
	Data    BilibiliUserInfo `json:"data"`
}

type CasdoorIdProvider added in v1.30.0

type CasdoorIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
	Host   string
}

func NewCasdoorIdProvider added in v1.30.0

func NewCasdoorIdProvider(clientId string, clientSecret string, redirectUrl string, hostUrl string) *CasdoorIdProvider

func (*CasdoorIdProvider) GetToken added in v1.30.0

func (idp *CasdoorIdProvider) GetToken(code string) (*oauth2.Token, error)

func (*CasdoorIdProvider) GetUserInfo added in v1.30.0

func (idp *CasdoorIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

func (*CasdoorIdProvider) SetHttpClient added in v1.30.0

func (idp *CasdoorIdProvider) SetHttpClient(client *http.Client)

type CasdoorToken added in v1.30.0

type CasdoorToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type CasdoorUserInfo added in v1.30.0

type CasdoorUserInfo struct {
	Id          string `json:"sub"`
	Name        string `json:"preferred_username,omitempty"`
	DisplayName string `json:"name"`
	Email       string `json:"email"`
	AvatarUrl   string `json:"picture"`
	Status      string `json:"status"`
	Msg         string `json:"msg"`
}

type CustomIdProvider added in v1.43.0

type CustomIdProvider struct {
	Client *http.Client
	Config *oauth2.Config

	UserInfoURL string
	TokenURL    string
	AuthURL     string
	UserMapping map[string]string
	Scopes      []string
}

func NewCustomIdProvider added in v1.43.0

func NewCustomIdProvider(idpInfo *ProviderInfo, redirectUrl string) *CustomIdProvider

func (*CustomIdProvider) GetToken added in v1.43.0

func (idp *CustomIdProvider) GetToken(code string) (*oauth2.Token, error)

func (*CustomIdProvider) GetUserInfo added in v1.43.0

func (idp *CustomIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

func (*CustomIdProvider) SetHttpClient added in v1.43.0

func (idp *CustomIdProvider) SetHttpClient(client *http.Client)

type CustomUserInfo added in v1.43.0

type CustomUserInfo struct {
	Id          string `mapstructure:"id"`
	Username    string `mapstructure:"username"`
	DisplayName string `mapstructure:"displayName"`
	Email       string `mapstructure:"email"`
	AvatarUrl   string `mapstructure:"avatarUrl"`
}

type DingTalkAccessToken

type DingTalkAccessToken struct {
	ErrCode     int    `json:"code"`
	ErrMsg      string `json:"message"`
	AccessToken string `json:"accessToken"` // Interface call credentials
	ExpiresIn   int64  `json:"expireIn"`    // access_token interface call credential timeout time, unit (seconds)
}

type DingTalkIdProvider

type DingTalkIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 DingTalkUserResponse struct {
	Nick      string `json:"nick"`
	OpenId    string `json:"openId"`
	UnionId   string `json:"unionId"`
	AvatarUrl string `json:"avatarUrl"`
	Email     string `json:"email"`
	Mobile    string `json:"mobile"`
	StateCode string `json:"stateCode"`
}

type DouyinIdProvider added in v1.53.0

type DouyinIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

func NewDouyinIdProvider added in v1.53.0

func NewDouyinIdProvider(clientId string, clientSecret string, redirectUrl string) *DouyinIdProvider

func (*DouyinIdProvider) GetToken added in v1.53.0

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 added in v1.53.0

func (idp *DouyinIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

GetUserInfo use token to get user profile

func (*DouyinIdProvider) SetHttpClient added in v1.53.0

func (idp *DouyinIdProvider) SetHttpClient(client *http.Client)

type DouyinTokenResp added in v1.53.0

type DouyinTokenResp struct {
	Data struct {
		AccessToken  string `json:"access_token"`
		ExpiresIn    int64  `json:"expires_in"`
		OpenId       string `json:"open_id"`
		RefreshToken string `json:"refresh_token"`
		Scope        string `json:"scope"`
	} `json:"data"`
	Message string `json:"message"`
}

type DouyinUserInfo added in v1.53.0

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 FacebookAccessToken struct {
	AccessToken string `json:"access_token"` // Interface call credentials
	TokenType   string `json:"token_type"`   // Access token type
	ExpiresIn   int64  `json:"expires_in"`   // access_token interface call credential timeout time, unit (seconds)
}

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

type FacebookIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 GiteeAccessToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	CreatedAt    int    `json:"created_at"`
}

type GiteeIdProvider

type GiteeIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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

type GithubIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 added in v1.33.1

type GithubToken struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	Scope       string `json:"scope"`
	Error       string `json:"error"`
}

type GitlabIdProvider

type GitlabIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 GitlabProviderToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	CreatedAt    int    `json:"created_at"`
}

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"`
	SharedRunnersMinutesLimit      interface{} `json:"shared_runners_minutes_limit"`
	ExtraSharedRunnersMinutesLimit interface{} `json:"extra_shared_runners_minutes_limit"`
}

type GoogleIdProvider

type GoogleIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 added in v1.373.0

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 added in v1.619.0

type GooglePeopleApiPhoneNumber struct {
	CanonicalForm string                             `json:"canonicalForm"`
	MetaData      GooglePeopleApiPhoneNumberMetaData `json:"metadata"`
	Value         string                             `json:"value"`
	Type          string                             `json:"type"`
}

type GooglePeopleApiPhoneNumberMetaData added in v1.619.0

type GooglePeopleApiPhoneNumberMetaData struct {
	Primary bool `json:"primary"`
}

type GooglePeopleApiResult added in v1.619.0

type GooglePeopleApiResult struct {
	PhoneNumbers []GooglePeopleApiPhoneNumber `json:"phoneNumbers"`
	Etag         string                       `json:"etag"`
	ResourceName string                       `json:"resourceName"`
}

type GoogleUserInfo

type GoogleUserInfo struct {
	Id            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Name          string `json:"name"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Picture       string `json:"picture"`
	Locale        string `json:"locale"`
}

type GothIdProvider

type GothIdProvider struct {
	Provider goth.Provider
	Session  goth.Session
}

func NewGothIdProvider

func NewGothIdProvider(providerType string, clientId string, clientSecret string, clientId2 string, clientSecret2 string, redirectUrl string, hostUrl string) (*GothIdProvider, error)

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 added in v1.16.0

type InfoflowIdProvider struct {
	Client  *http.Client
	Config  *oauth2.Config
	AgentId string
	Ticket  string
}

func NewInfoflowIdProvider added in v1.16.0

func NewInfoflowIdProvider(clientId string, clientSecret string, appId string, redirectUrl string) *InfoflowIdProvider

func (*InfoflowIdProvider) GetToken added in v1.16.0

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 added in v1.16.0

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 added in v1.16.0

func (idp *InfoflowIdProvider) SetHttpClient(client *http.Client)

type InfoflowInterToken added in v1.16.0

type InfoflowInterToken struct {
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
	AccessToken string `json:"access_token"`
}

type InfoflowInternalIdProvider added in v1.16.0

type InfoflowInternalIdProvider struct {
	Client  *http.Client
	Config  *oauth2.Config
	AgentId string
}

func NewInfoflowInternalIdProvider added in v1.16.0

func NewInfoflowInternalIdProvider(clientId string, clientSecret string, appId string, redirectUrl string) *InfoflowInternalIdProvider

func (*InfoflowInternalIdProvider) GetToken added in v1.16.0

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 added in v1.16.0

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 added in v1.16.0

func (idp *InfoflowInternalIdProvider) SetHttpClient(client *http.Client)

type InfoflowInternalUserInfo added in v1.16.0

type InfoflowInternalUserInfo struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
	UserId  string `json:"userid"`
	Imid    int    `json:"imid"`
	Name    string `json:"name"`
	Avatar  string `json:"headimg"`
	Email   string `json:"email"`
}

type InfoflowInternalUserResp added in v1.16.0

type InfoflowInternalUserResp struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
	UserId  string `json:"UserId"`
}

type InfoflowToken added in v1.16.0

type InfoflowToken struct {
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
	AccessToken string `json:"suite_access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type InfoflowUserInfo added in v1.16.0

type InfoflowUserInfo struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
	Imid    string `json:"imid"`
	Name    string `json:"name"`
	Email   string `json:"email"`
}

type InfoflowUserResp added in v1.16.0

type InfoflowUserResp struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
	UserId  string `json:"UserId"`
}

type LarkAccessToken

type LarkAccessToken struct {
	Code              int    `json:"code"`
	Msg               string `json:"msg"`
	TenantAccessToken string `json:"tenant_access_token"`
	Expire            int    `json:"expire"`
}

type LarkIdProvider

type LarkIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 LinkedInAccessToken struct {
	AccessToken string `json:"access_token"` // Interface call credentials
	ExpiresIn   int64  `json:"expires_in"`   // access_token interface call credential timeout time, unit (seconds)
}

type LinkedInIdProvider

type LinkedInIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 LinkedInUserEmail struct {
	Elements []struct {
		Handle struct {
			EmailAddress string `json:"emailAddress"`
		} `json:"handle~"`
		Handle1 string `json:"handle"`
	} `json:"elements"`
}

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 added in v1.367.0

type MetaMaskIdProvider struct {
	Client *http.Client
}

func NewMetaMaskIdProvider added in v1.367.0

func NewMetaMaskIdProvider() *MetaMaskIdProvider

func (*MetaMaskIdProvider) GetToken added in v1.367.0

func (idp *MetaMaskIdProvider) GetToken(code string) (*oauth2.Token, error)

func (*MetaMaskIdProvider) GetUserInfo added in v1.367.0

func (idp *MetaMaskIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

func (*MetaMaskIdProvider) SetHttpClient added in v1.367.0

func (idp *MetaMaskIdProvider) SetHttpClient(client *http.Client)

type OktaIdProvider added in v1.46.0

type OktaIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
	Host   string
}

func NewOktaIdProvider added in v1.46.0

func NewOktaIdProvider(clientId string, clientSecret string, redirectUrl string, hostUrl string) *OktaIdProvider

func (*OktaIdProvider) GetToken added in v1.46.0

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 added in v1.46.0

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 added in v1.46.0

func (idp *OktaIdProvider) SetHttpClient(client *http.Client)

type OktaToken added in v1.46.0

type OktaToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	RefreshToken string `json:"refresh_token"`
	IdToken      string `json:"id_token"`
}

type OktaUserInfo added in v1.46.0

type OktaUserInfo struct {
	Email             string `json:"email"`
	Name              string `json:"name"`
	PreferredUsername string `json:"preferred_username"`
	Picture           string `json:"picture"`
	Sub               string `json:"sub"`
}

type ProviderInfo added in v1.358.0

type ProviderInfo struct {
	Type          string
	SubType       string
	ClientId      string
	ClientSecret  string
	ClientId2     string
	ClientSecret2 string
	AppId         string
	HostUrl       string
	RedirectUrl   string

	TokenURL    string
	AuthURL     string
	UserInfoURL string
	UserMapping map[string]string
}

type QqIdProvider

type QqIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 added in v1.509.0

type TwitterAccessToken struct {
	AccessToken string `json:"access_token"` // Interface call credentials
	TokenType   string `json:"token_type"`   // Access token type
	ExpiresIn   int64  `json:"expires_in"`   // access_token interface call credential timeout time, unit (seconds)
}

type TwitterCheckToken added in v1.509.0

type TwitterCheckToken struct {
	Data TwitterUserInfo `json:"data"`
}

type TwitterCheckTokenData added in v1.509.0

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 added in v1.509.0

type TwitterIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

func NewTwitterIdProvider added in v1.509.0

func NewTwitterIdProvider(clientId string, clientSecret string, redirectUrl string) *TwitterIdProvider

func (*TwitterIdProvider) GetToken added in v1.509.0

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 added in v1.509.0

func (idp *TwitterIdProvider) GetUrlResp(url *http.Request) (string, error)

func (*TwitterIdProvider) GetUserInfo added in v1.509.0

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 added in v1.509.0

func (idp *TwitterIdProvider) SetHttpClient(client *http.Client)

type TwitterUserInfo added in v1.509.0

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 UserInfo

type UserInfo struct {
	Id          string
	Username    string
	DisplayName string
	UnionId     string
	Email       string
	Phone       string
	CountryCode string
	AvatarUrl   string
	Extra       map[string]string
}

type WeChatIdProvider

type WeChatIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 added in v1.41.0

type WeChatMiniProgramIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

func NewWeChatMiniProgramIdProvider added in v1.41.0

func NewWeChatMiniProgramIdProvider(clientId string, clientSecret string) *WeChatMiniProgramIdProvider

func (*WeChatMiniProgramIdProvider) GetSessionByCode added in v1.41.0

func (*WeChatMiniProgramIdProvider) SetHttpClient added in v1.41.0

func (idp *WeChatMiniProgramIdProvider) SetHttpClient(client *http.Client)

type WeChatMiniProgramSessionResponse added in v1.41.0

type WeChatMiniProgramSessionResponse struct {
	Openid     string `json:"openid"`
	SessionKey string `json:"session_key"`
	Unionid    string `json:"unionid"`
	Errcode    int    `json:"errcode"`
	Errmsg     string `json:"errmsg"`
}

type WeComIdProvider

type WeComIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 added in v1.14.0

type WeComInternalIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

WeComInternalIdProvider This idp is using wecom internal application api as idp

func NewWeComInternalIdProvider added in v1.14.0

func NewWeComInternalIdProvider(clientId string, clientSecret string, redirectUrl string) *WeComInternalIdProvider

func (*WeComInternalIdProvider) GetToken added in v1.14.0

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 added in v1.14.0

func (idp *WeComInternalIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

func (*WeComInternalIdProvider) SetHttpClient added in v1.14.0

func (idp *WeComInternalIdProvider) SetHttpClient(client *http.Client)

type WeComProviderToken

type WeComProviderToken struct {
	Errcode             int    `json:"errcode"`
	Errmsg              string `json:"errmsg"`
	ProviderAccessToken string `json:"provider_access_token"`
	ExpiresIn           int    `json:"expires_in"`
}

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 added in v1.367.0

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 added in v1.388.0

type Web3OnboardIdProvider struct {
	Client *http.Client
}

func NewWeb3OnboardIdProvider added in v1.388.0

func NewWeb3OnboardIdProvider() *Web3OnboardIdProvider

func (*Web3OnboardIdProvider) GetToken added in v1.388.0

func (idp *Web3OnboardIdProvider) GetToken(code string) (*oauth2.Token, error)

func (*Web3OnboardIdProvider) GetUserInfo added in v1.388.0

func (idp *Web3OnboardIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)

func (*Web3OnboardIdProvider) SetHttpClient added in v1.388.0

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 added in v1.525.0

type WechatCacheMapValue struct {
	IsScanned     bool
	WechatUnionId string
}

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 added in v1.14.0

type WecomInterToken struct {
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type WecomInternalUserInfo added in v1.14.0

type WecomInternalUserInfo struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
	Name    string `json:"name"`
	Email   string `json:"email"`
	Avatar  string `json:"avatar"`
	OpenId  string `json:"open_userid"`
	UserId  string `json:"userid"`
}

type WecomInternalUserResp added in v1.14.0

type WecomInternalUserResp struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
	UserId  string `json:"UserId"`
	OpenId  string `json:"OpenId"`
}

type WeiBoIdProvider

type WeiBoIdProvider struct {
	Client *http.Client
	Config *oauth2.Config
}

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 WeiboAccessToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	RemindIn    string `json:"remind_in"` // This parameter is about to be obsolete, developers please use expires_in
	Uid         string `json:"uid"`
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL