當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Config.ClientID方法代碼示例

本文整理匯總了Golang中golang.org/x/oauth2.Config.ClientID方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.ClientID方法的具體用法?Golang Config.ClientID怎麽用?Golang Config.ClientID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在golang.org/x/oauth2.Config的用法示例。


在下文中一共展示了Config.ClientID方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: overrideCredentials

// overrideCredentials sets the ClientID and ClientSecret from the
// config file if they are not blank
func overrideCredentials(name string, config *oauth2.Config) {
	ClientID := fs.ConfigFile.MustValue(name, ConfigClientID)
	if ClientID != "" {
		config.ClientID = ClientID
	}
	ClientSecret := fs.ConfigFile.MustValue(name, ConfigClientSecret)
	if ClientSecret != "" {
		config.ClientSecret = ClientSecret
	}
}
開發者ID:K4Y5,項目名稱:rclone,代碼行數:12,代碼來源:oauthutil.go

示例2: overrideCredentials

// overrideCredentials sets the ClientID and ClientSecret from the
// config file if they are not blank.
// If any value is overridden, true is returned.
func overrideCredentials(name string, config *oauth2.Config) bool {
	changed := false
	ClientID := fs.ConfigFile.MustValue(name, fs.ConfigClientID)
	if ClientID != "" {
		config.ClientID = ClientID
		changed = true
	}
	ClientSecret := fs.ConfigFile.MustValue(name, fs.ConfigClientSecret)
	if ClientSecret != "" {
		config.ClientSecret = ClientSecret
		changed = true
	}
	return changed
}
開發者ID:pombredanne,項目名稱:rclone,代碼行數:17,代碼來源:oauthutil.go

示例3: 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)
		}
	}
}
開發者ID:sbinet,項目名稱:fedid,代碼行數:29,代碼來源:security.go


注:本文中的golang.org/x/oauth2.Config.ClientID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。