简体   繁体   English

钥匙斗篷 | 如何添加自定义密钥斗篷密码策略?

[英]Keycloak | How to add custom keycloak password policies?

I'm working on a new project that uses Keycloak platform.我正在开发一个使用 Keycloak 平台的新项目。 I want to find a way to add custom password policies in the Authentication tab.我想找到一种在身份验证选项卡中添加自定义密码策略的方法。 I want to add a dictionary with blacklist words that these can't be included in password of a user我想添加一个带有黑名单单词的字典,这些单词不能包含在用户密码中

for example from the blacklist dictionary the word "testing" should block all passwords that contains "testing" inside line "123testing@123",... etc例如,从黑名单字典中,单词“testing”应该阻止所有在“123testing@123”行内包含“testing”的密码,...等

Also i have multi requirements of password policies that can be done with the option that Keycloak offers in the drop-down menu of password policies.此外,我对密码策略有多种要求,可以通过 Keycloak 在密码策略下拉菜单中提供的选项来完成。 I found in some forums that i have to create my own Authentication SPI but i can find any documentation that explains step to step (from scratch) how to achieve this.我在一些论坛上发现我必须创建自己的身份验证 SPI,但我可以找到任何说明逐步(从头开始)如何实现这一点的文档。

To implement an SPI you need to implement it's ProviderFactory and Provider interfaces.要实现 SPI,您需要实现它的 ProviderFactory 和 Provider 接口。 You also need to create a service configuration file.您还需要创建一个服务配置文件。

For password policy - You would need to implememnt PasswordPolicyProviderFactory.java and the implmentation will go in CustomPasswordPolicyProviderClass which will implements PasswordPolicyProvider.java class.对于密码策略 - 您需要实施 PasswordPolicyProviderFactory.java 并且实施将进入 CustomPasswordPolicyProviderClass ,它将实施 PasswordPolicyProvider.java 类。

This way you should be able to register this policy in keycloak and can configure in the realm UI.通过这种方式,您应该能够在 keycloak 中注册此策略并可以在领域 UI 中进行配置。 Refer this for the contract - Service Provider Interfaces请参阅合同 - 服务提供商接口

I cannot get an SPI working for a keycloak Realm Password Policy. 我无法获得用于密钥斗篷领域密码策略的SPI。

Preface: we are using Keycloak Version 4.5.1 FINAL. 前言:我们正在使用Keycloak版本4.5.1 FINAL。

I have successfully dev'd and deployed other keycloak SPIs so I am familiar with the general workflow: 我已经成功开发和部署了其他密钥斗篷SPI,所以我熟悉一般的工作流程:

-implementing a given interface -实现给定的接口
-insuring there is a services file in META-INF/services in the jar -modifying standalone-ha.xml -确保jar上的META-INF / services中有一个服务文件-modify standalone-ha.xml
-deploying the jar and module.xml to the wildfly modules directory, etc. -将jar和module.xml部署到wildfly modules目录等。

I am getting no errors in the server logs after deploying, however I cannot see the Password Policy Provider in the keycloak admin/providers web GUI. 部署后,服务器日志中没有出现任何错误,但是在keycloak admin / providers Web GUI中看不到密码策略提供程序。

Is there a specific methodology for Realm Password Providers that is documented and that works? 是否有针对文档的有效的Realm密码提供程序的特定方法?

Thanks 谢谢

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

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