简体   繁体   English

如何通过keycloak向github企业中的每个用户添加主要电子邮件?

[英]How to add primary email to every users in github enterprise via keycloak?

I have github enterprise configured.我已经配置了github企业。 I use keycloak for authentication.我使用 keycloak 进行身份验证。

Sign up/ login flow is like this,注册/登录流程是这样的,

Users click sign in with SAML from github enterprise.用户从 github 企业点击使用 SAML 登录。

Then they are redirected to keycloak login page.然后他们被重定向到 keycloak 登录页面。

Where they can choose github.com for signup.他们可以在哪里选择 github.com 进行注册。

After successful authentication from github.com users are redirected to github enterprise.来自 github.com 的用户身份验证成功后,将被重定向到 github 企业。

Now a new user has been created in keycloak with username as of github.com username and email as of github.com email.现在已经在 keycloak 中创建了一个新用户,其用户名为 github.com 用户名,电子邮件为 github.com 电子邮件。

But in github enterprise, user's username is created by parsing the first part before the @ of email id and user's email id is not getting updated in github enterprise user account even though github enterprise is receiving email id from keycloak.但是在github企业中,用户的用户名是通过解析电子邮件ID@之前的第一部分创建的,即使github企业正在从keycloak接收电子邮件ID,用户的电子邮件ID也不会在github企业用户帐户中更新。

Users get the following notification, saying them to add one email address.用户收到以下通知,要求他们添加一个电子邮件地址。

每个新用户都会收到此通知,直到他们手动添加电子邮件

If an user don't add their email, they don't get email for events like organization invitation, password reset.如果用户不添加他们的电子邮件,他们将不会收到有关组织邀请、密码重置等事件的电子邮件。

This not what i want.这不是我想要的。 I also not what the users to manually add email id to their account.我也不知道用户手动将电子邮件 ID 添加到他们的帐户中。

I want get github enterprise user's username and email to be the same as of keycloak.我想让 github 企业用户的用户名和电子邮件与 keycloak 相同。

How can i achieve this ?我怎样才能做到这一点?

We have extracted saml response from keycloak to ghe by inspecting the /consume request in browser network.我们通过检查浏览器网络中的/consume请求,从 keycloak 中提取了 saml 响应到 ghe。 When SAML response is decoded (using samltool.io), we identified that keycloak is not sending email attribute to ghe.当 SAML 响应被解码(使用 samltool.io)时,我们发现 keycloak 没有向 ghe 发送电子邮件属性。

Github used the following attributes for updating profile information. Github 使用以下属性来更新配置文件信息。 So keycloak needs to send attribute in variable specified in this field.所以keycloak需要在这个字段中指定的变量中发送属性。

在此处输入图片说明

We have found that there is some builtin "Mappers" available in client which can be used for sending some specified predetermined attributes to client applications.我们发现客户端中有一些内置的“映射器”,可用于将一些指定的预定属性发送到客户端应用程序。

Select your client -> Mappers -> Add builtin.选择您的客户端 -> Mappers -> Add builtin。 Select the required mappers and click Add.选择所需的映射器并单击添加。

在此处输入图片说明

Open x500 Email and set "SAML Attribute Name" to the variable same as the variable name set on github.打开 x500 Email,将“SAML 属性名称”设置为与 github 上设置的变量名称相同的变量。 Provide some Property and Friendly Name.提供一些属性和友好名称。

在此处输入图片说明

Now you will get email address in user's account.现在您将在用户帐户中获得电子邮件地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM