本文整理汇总了Golang中github.com/openshift/origin/pkg/auth/api.UserIdentityInfo.GetProviderName方法的典型用法代码示例。如果您正苦于以下问题:Golang UserIdentityInfo.GetProviderName方法的具体用法?Golang UserIdentityInfo.GetProviderName怎么用?Golang UserIdentityInfo.GetProviderName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/origin/pkg/auth/api.UserIdentityInfo
的用法示例。
在下文中一共展示了UserIdentityInfo.GetProviderName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createIdentityAndMapping
// createIdentityAndMapping creates an identity with a valid user reference for the given identity info
func (p *provisioningIdentityMapper) createIdentityAndMapping(ctx kapi.Context, info authapi.UserIdentityInfo) (kuser.Info, error) {
// Build the part of the identity we know about
identity := &userapi.Identity{
ObjectMeta: kapi.ObjectMeta{
Name: info.GetIdentityName(),
},
ProviderName: info.GetProviderName(),
ProviderUserName: info.GetProviderUserName(),
Extra: info.GetExtra(),
}
// Get or create a persisted user pointing to the identity
persistedUser, err := p.provisioningStrategy.UserForNewIdentity(ctx, getPreferredUserName(identity), identity)
if err != nil {
return nil, err
}
// Create the identity pointing to the persistedUser
identity.User = kapi.ObjectReference{
Name: persistedUser.Name,
UID: persistedUser.UID,
}
if _, err := p.identity.CreateIdentity(ctx, identity); err != nil {
return nil, err
}
return &kuser.DefaultInfo{
Name: persistedUser.Name,
UID: string(persistedUser.UID),
Groups: persistedUser.Groups,
}, nil
}