本文整理匯總了Golang中golang.org/x/oauth2.Config.Endpoint方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.Endpoint方法的具體用法?Golang Config.Endpoint怎麽用?Golang Config.Endpoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類golang.org/x/oauth2.Config
的用法示例。
在下文中一共展示了Config.Endpoint方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Github
// Github returns a new Github OAuth 2.0 backend endpoint.
func Github(conf *oauth2.Config) macaron.Handler {
conf.Endpoint = oauth2.Endpoint{
AuthURL: "https://github.com/login/oauth/authorize",
TokenURL: "https://github.com/login/oauth/access_token",
}
return NewOAuth2Provider(conf)
}
示例2: LinkedIn
// LinkedIn returns a new LinkedIn OAuth 2.0 backend endpoint.
func LinkedIn(conf *oauth2.Config) macaron.Handler {
conf.Endpoint = oauth2.Endpoint{
AuthURL: "https://www.linkedin.com/uas/oauth2/authorization",
TokenURL: "https://www.linkedin.com/uas/oauth2/accessToken",
}
return NewOAuth2Provider(conf)
}
示例3: Facebook
// Facebook returns a new Facebook OAuth 2.0 backend endpoint.
func Facebook(conf *oauth2.Config) macaron.Handler {
conf.Endpoint = oauth2.Endpoint{
AuthURL: "https://www.facebook.com/dialog/oauth",
TokenURL: "https://graph.facebook.com/oauth/access_token",
}
return NewOAuth2Provider(conf)
}
示例4: WeChat
// WeChat returns a new WeChat OAuth 2.0 backend endpoint
func WeChat(conf *oauth2.Config) martini.Handler {
conf.Endpoint = oauth2.Endpoint{
AuthURL: "https://open.weixin.qq.com/connect/qrconnect",
TokenURL: "https://api.weixin.qq.com/sns/oauth2/access_token?grant_type=authorization_code",
}
return NewOAuth2ProviderCN(conf)
}
示例5: OAuthConfigurationManager
/**
* This creates a new OAuth configuration and synchronizes concurrent access
* to that configuration.
* This is expected since ServerHTTP run on their own goroutine
* @param path is the path to retrieve CA certificates
* @param c is the channel to write to
* @see #PopulateCertPool(string)
*/
func OAuthConfigurationManager(clientid, clientsecret, redirecturl, authurl, tokenurl string, c chan *oauth2.Config) {
var logger = NewPrefixed("security#OAuthConfigurationManager")
oauthConfig := new(oauth2.Config)
oauthConfig.ClientID = clientid
oauthConfig.ClientSecret = clientsecret
oauthConfig.Scopes = []string{"email"}
oauthConfig.RedirectURL = redirecturl
oauthConfig.Endpoint = oauth2.Endpoint{
AuthURL: authurl,
TokenURL: tokenurl,
}
for {
select {
case c <- oauthConfig:
logger.Finest("Written OAuthconf : %v", oauthConfig)
}
}
}
示例6: Google
// Google returns a new Google OAuth 2.0 backend endpoint.
func Google(conf *oauth2.Config) macaron.Handler {
conf.Endpoint = google.Endpoint
return NewOAuth2Provider(conf)
}