- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在设置一个新的 KeyCloak 实例,我正试图实现以下目标:用户将被放置在- 团体- 这些组将获得客户特定的角色
例如,我有角色“Publishers”和几组发布者:Publisher1、Publisher2、...
因此,当用户登录时,我可以确定他是否是发布者,然后授予他访问网站上一组特定功能的权限。然后小组将缩小他将收到的所有信息。
就像该角色将授予他访问 REST API 的权限,并且该组将过滤他将收到的结果。
在 SQL 中:SELECT * FROM xyz where publisher_id = ?
在 token 中我想查看这些信息。使用评估功能时,我目前收到:
{
"jti": "3e96fc9d-b1dc-428a-8f8e-0661f9cf265b",
"exp": 1578303161,
"nbf": 0,
"iat": 1578302861,
"iss": "https://prodo-sso-ti.ariva-services.de/auth/realms/PRODO",
"aud": "account",
"sub": "55bed571-dd3b-4282-8688-5da543517a49",
"typ": "Bearer",
"azp": "dashboard",
"auth_time": 0,
"session_state": "12ab2b8c-dc9a-42ca-b106-1a213dd38fc0",
"acr": "1",
"allowed-origins": [
"https://secretlink"
],
"realm_access": {
"roles": [
"offline_access",
"uma_authorization"
]
},
"resource_access": {
"account": {
"roles": [
"manage-account",
"manage-account-links",
"view-profile"
]
},
"dashboard": {
"roles": [
"Publisher"
]
}
},
"scope": "openid profile email",
"group_membership": [
"/Publisher1"
],
"email_verified": true,
"name": "My Name",
"preferred_username": "mb",
"locale": "de",
"given_name": "My",
"family_name": "Name",
"email": "my@name.de"
}
我激活了组成员映射器以获取用户所在的组。问题是,我只得到组的名称,而我需要更有用的东西,比如 ID。因此,我尝试将属性添加到数值为“1”的组“publisher_id”。
如何在组成员信息或其他地方也获得此 publisher_id。或者也许我走错了路,这可以以某种不同的方式实现?
我很感激任何提示:)
最佳答案
有一种简单的方法可以将 Groups Id 添加到 token 中:
Clients Scopes -> Create -> Client Scope Template(Audience template) -> your_client_name
Clients Scopes -> your_client_name -> Mappers -> Create
然后将此代码粘贴到脚本部分:
/**
* Available variables:
* user - the current user
* realm - the current realm
* token - the current token
* userSession - the current userSession
* keycloakSession - the current userSession
*/
//insert your code here...
var groups = [];
for each (var group in user.getGroups()) groups.push(group.getId());
token.setOtherClaims("groups_ids",
Java.to(groups, "java.lang.String[]")
);
不要忘记设置添加到访问 token 。
您将在您的 token 中看到它: groups_ids
关于 token 中的 KeyCloak 组 ID 丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59609731/
我已将 Keycloak 设置为 SAML 代理,身份验证由当局提供的外部 IdP 完成。使用此 IdP 登录的用户都被接受,我们需要从 Keycloak 获得一个 OAuth token 来访问我们
我在 master 有一个服务帐号领域。来自 admin-cli我要分配服务帐号master-realm-client管理员角色。我怎样才能做到这一点。 kcadm.sh add-roles -r m
在 Keycloak 中,是否可以对同一领域中的所有客户端仅进行一次登录?我已经以这种方式配置了服务器(从管理控制台): - 创建一个新领域(我们称之为 MyRealm); - 创建两个不同的客户端(
我们的团队正在开发一个集成到 Keycloak 中的项目。我们创建了一个自定义领域,例如 ProjectX ,并使其上的自定义主题能够应用于 Keycloak 的登录页面。 由于我们的主题应用于领域
Keycloak 是一个很棒的工具,但它缺乏适当的文档。 所以我们有 Realm.roles、Client.roles 和 User.roles 使用特定客户端访问应用程序时,这 3 者如何协同工作?
我们的团队正在开发一个集成到 Keycloak 中的项目。我们创建了一个自定义领域,例如 ProjectX ,并使其上的自定义主题能够应用于 Keycloak 的登录页面。 由于我们的主题应用于领域
有没有办法让所有用户在 keycloak 中创建自定义用户属性(如电话号码)? 最佳答案 您可以创建一个组并向其添加一个属性。 然后将该组设置为默认组。这样,所有用户都可以使用设置为组的属性 关于ke
我还尝试了 Web 来源和有效重定向 URI 的所有不同组合 我通过 keycloak 登录,它不断地在我的本地主机应用程序和这个 url 之间来回重定向我:http://localhost:4200
在 Keycloak's documentation ,据说为了部署提供程序,我可以 copy your provider jar to the Keycloak deploy/ directory,
目前,我使用此端点一次将用户添加到一个组: PUT /{realm}/users/{id}/groups/{groupId} 在我的用例中,批量执行影响是有益的,到目前为止我还没有找到这样做的记录方式
目前,我使用此端点一次将用户添加到一个组: PUT /{realm}/users/{id}/groups/{groupId} 在我的用例中,批量执行影响是有益的,到目前为止我还没有找到这样做的记录方式
我一直在尝试在 docker-compose 文件中使用 jboss/keycloak-mysql 来建立 Keycloak 服务器和 mysql 数据库。我在本地部署期间遇到一个问题,告诉我 WEB
我正在使用 Tomcat 适配器运行 Keycloak。但是,当我尝试获取 KeycloakPrincipal 时,它出错了; java.lang.ClassCastException: org.ke
我正在使用 keycloak 4.5.0 v 并创建了一个领域。我已经设置了登录以启用忘记用户名和验证电子邮件。在我输入的电子邮件选项卡中 host - smtp.gmail.com smtp po
我想让我的客户端应用程序从 keycloak 访问用户信息。因此,我在 keycloak 中创建了另一个领域 (myrealm1),并在该领域内创建了一个新客户端 (myclient1)。 key 斗
正如我在此链接中看到的 https://www.keycloak.org/docs/latest/authorization_services/#_overview ,客户端中应该有一个授权选项卡,如
这些 keycloak 端点有什么用? issuer: "http://localhost:8180/auth/realms/dev", authorization_endpoint: "http:/
我们需要将数百个用户从 csv 文件导入 Keycloak。我还没有找到任何现成的导入功能来做到这一点。 有没有人做过任何导入程序或至少有一些框架来构建? REST API 可能是唯一的方法 - 或者
我已经使用 LDAP 用户联盟配置了 Keycloak。当用户想要登录应用程序时,他会被重定向到 Keycloak 登录页面,输入 uid/pwd 并使用 LDAP 绑定(bind)进行身份验证。 这
有没有人在 Keycloak 中使用过 SCIM?如果是这样,你能指出我的文档吗?我用谷歌搜索过,它似乎不是受支持的配置。 最佳答案 不幸的是,Keycloak 尚不支持 SCIM。他们的 Jira
我是一名优秀的程序员,十分优秀!