我编写了自己的自定义令牌映射器,将每个组分配给用户的所有角色映射到访问令牌,作为从组名到角色列表的映射(对象)的单个声明。
但是我似乎无法部署它。这是我的自定义映射器:
public class HierarchicalAttributesMapper extends AbstractOIDCProtocolMapper
implements OIDCAccessTokenMapper, OIDCIDTokenMapper, UserInfoTokenMapper {...}
它基于GroupMembershipMapper。我在编译的jar的顶层添加了以下文件:
META-INF/services/org.keycloak.broker.provider.IdentityProviderMapper
使用我的HierarchicalAttributesMapper的FQN。运行我的docker容器以获取keycloak时,会挂载到/ opt / jboss / standalone / deployments文件夹,但它会被识别,但随后会抛出此警告:
[org.jboss.modules] (ServerService Thread Pool -- 58) Failed to define class
technology.idlab.cot.keycloak.oidc.HierarchicalAttributesMapper in Module
"deployment.keycloak-oidc-hierarchical-attributes-mapper-1.0-SNAPSHOT.jar"
from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
technology/idlab/cot/keycloak/oidc/HierarchicalAttributesMapper (Module
"deployment.keycloak-oidc-hierarchical-attributes-mapper-1.0-SNAPSHOT.jar"
from Service Module Loader):
org/keycloak/protocol/oidc/mappers/OIDCAccessTokenMapper
(stack-trace omitted)
有没有人知道如何才能让它发挥作用?