如何设置Keycloak中自定义协议映射器的顺序?

huangapple go评论78阅读模式
英文:

How to set order of custom ProtocolMapper in keycloak?

问题

我在Keycloak中有许多自定义的ProtocolMapper,它们运行良好。

但是它们的工作顺序对我来说不太清楚。我曾认为工作顺序等于org.keycloak.protocol.ProtocolMapper中字符串的顺序,但这并不正确。

我的注册文件如下:

com.example.sso.mapper.FirstMapper // 第二个运行
com.example.sso.mapper.SecondMapper // 第一个运行
com.example.sso.mapper.ThirdMapper // 第三个运行

我如何控制它们的工作顺序?

英文:

I have many custom ProtocolMapper in keycloak and they work fine.

But order of work is not clear for me. I was thinking that order equals order of string in org.keycloak.protocol.ProtocolMapper but it is not true.

My registration file

com.example.sso.mapper.FirstMapper // work second
com.example.sso.mapper.SecondMapper // work first
com.example.sso.mapper.ThirdMapper // work third

How can i controll order of they work?

答案1

得分: 1

根据我所知,您无法控制映射器的顺序。如果一个映射器依赖于另一个映射器设置的信息,也许您应该考虑将它们合并为一个单一的映射器。setClaim 函数可以一次向令牌添加多个声明。这样,您可以确保所有所需的声明都已设置。

英文:

As far as I am aware, you cannot control the order of mappers. If one mapper depends on information that another mapper sets, maybe you should consider turning them into a single mapper. The setClaim function can add multiple claims to a token at the same time. That way you can be certain that all your required claims are set.

huangapple
  • 本文由 发表于 2023年7月31日 23:10:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76804939.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定