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


Golang ldaputil.QueryForUniqueEntry函數代碼示例

本文整理匯總了Golang中github.com/openshift/origin/pkg/auth/ldaputil.QueryForUniqueEntry函數的典型用法代碼示例。如果您正苦於以下問題:Golang QueryForUniqueEntry函數的具體用法?Golang QueryForUniqueEntry怎麽用?Golang QueryForUniqueEntry使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: queryForUser

// queryForUser queries for an LDAP user entry identified with an LDAP user UID on an LDAP server
// determined from a clientConfig by creating a search request from an LDAP query template and
// determining which attributes to search for with a LDAPuserAttributeDefiner
func (e *LDAPInterface) queryForUser(ldapUserUID string) (*ldap.Entry, error) {
	// create the search request
	searchRequest, err := e.userQuery.NewSearchRequest(ldapUserUID, e.requiredUserAttributes())
	if err != nil {
		return nil, err
	}

	return ldaputil.QueryForUniqueEntry(e.clientConfig, searchRequest)
}
開發者ID:ncantor,項目名稱:origin,代碼行數:12,代碼來源:ldapinterface.go

示例2: queryForGroup

// queryForGroup queries for a specific group identified by a ldapGroupUID with the query config stored
// in a LDAPInterface
func (e *LDAPInterface) queryForGroup(ldapGroupUID string) (group *ldap.Entry, err error) {
	allAttributes := sets.NewString(e.groupNameAttributes...)
	allAttributes.Insert(e.groupMembershipAttributes...)

	// create the search request
	searchRequest, err := e.groupQuery.NewSearchRequest(ldapGroupUID, allAttributes.List())
	if err != nil {
		return nil, err
	}

	return ldaputil.QueryForUniqueEntry(e.clientConfig, searchRequest)
}
開發者ID:rusenask,項目名稱:origin,代碼行數:14,代碼來源:ldapinterface.go

示例3: userEntryFor

// userEntryFor returns an LDAP group entry for the given group UID by searching the internal cache
// of the LDAPInterface first, then sending an LDAP query if the cache did not contain the entry
func (e *LDAPInterface) userEntryFor(ldapUserUID string) (user *ldap.Entry, err error) {
	user, exists := e.cachedUsers[ldapUserUID]
	if exists {
		return user, nil
	}

	searchRequest, err := e.userQuery.NewSearchRequest(ldapUserUID, e.requiredUserAttributes())
	if err != nil {
		return nil, err
	}

	user, err = ldaputil.QueryForUniqueEntry(e.clientConfig, searchRequest)
	if err != nil {
		return nil, err
	}
	e.cachedUsers[ldapUserUID] = user
	return user, nil
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:20,代碼來源:ldapinterface.go

示例4: GroupEntryFor

// GroupEntryFor returns an LDAP group entry for the given group UID by searching the internal cache
// of the LDAPInterface first, then sending an LDAP query if the cache did not contain the entry.
// This also satisfies the LDAPGroupGetter interface
func (e *LDAPInterface) GroupEntryFor(ldapGroupUID string) (*ldap.Entry, error) {
	group, exists := e.cachedGroups[ldapGroupUID]
	if exists {
		return group, nil
	}

	searchRequest, err := e.groupQuery.NewSearchRequest(ldapGroupUID, e.requiredGroupAttributes())
	if err != nil {
		return nil, err
	}

	group, err = ldaputil.QueryForUniqueEntry(e.clientConfig, searchRequest)
	if err != nil {
		return nil, err
	}
	e.cachedGroups[ldapGroupUID] = group
	return group, nil
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:21,代碼來源:ldapinterface.go


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