简体   繁体   English

如何绕过keycloak登录页面?

[英]How to bypass the keycloak login page?

I am working on a ReactJS application with a Java background.我正在开发具有 Java 背景的 ReactJS 应用程序。 Is it possible to use a login other than that of keycloak.是否可以使用 keycloak 以外的登录名。

I know it's possible to custom the default keycloak theme and add custom field also but I really want to use my reactjs login form instead of redirecting to that of keycloak.我知道可以自定义默认的 keycloak 主题并添加自定义字段,但我真的想使用我的 reactjs 登录表单而不是重定向到 keycloak 的登录表单。

Is it possible?可能吗? Is it recommended?推荐吗?

There is already a similar question on stackoverflow but not the right answer to the problem. stackoverflow 上已经有一个类似的问题,但不是该问题的正确答案。

Thank you all for answering my question谢谢大家回答我的问题

Is it possible?可能吗?

Yes, the user would insert the username and password into your form.是的,用户会将usernamepassword插入到您的表单中。 And you would perform behind the curtains a call to a Keycloak Client that you would have to configure with the " Resource Owner Password Credential Grant " flow ( ie, Direct access Grants Enabled in Keycloak ).并且您将在幕后执行对Keycloak Client的调用,您必须使用“资源所有者密码凭据授予”流程进行配置(即,在 Keycloak 中启用直接访问授予)。 That call would be requesting a token on the user's behalf.调用将代表用户请求令牌。

Now the problem with this approach is that Resource Owner Password Credential Grant should typically be avoided ( source ):现在这种方法的问题是通常应该避免资源所有者密码凭证授予来源):

The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application.资源所有者密码凭证授予类型适用于资源所有者与客户端具有信任关系的情况,例如设备操作系统或高特权应用程序。 The authorization server should take special care when enabling this grant type and only allow it when other flows are not viable .授权服务器在启用此授权类型时应特别小心,并且仅在其他流程不可行时才允许它

You can read more on why it is not recommended to use that flow in sources such as this .您可以阅读更多关于为什么不建议在诸如此类的来源中使用流程的信息。

So you would be compromising a bite of security there.所以你会在那里牺牲一点安全性。 Moreover, you might want to provide other Keycloak functionality ( eg, OTP and social media login) that is seamlessly integrated with its Theme template.此外,您可能希望提供与其主题模板无缝集成的其他 Keycloak 功能(例如, OTP和社交媒体登录)。 Then you might have to adapt your application based on new Keycloak releases and so on.然后您可能必须根据新的 Keycloak 版本等调整您的应用程序。 Unless you really have a very good reason to I would not recommend it.除非你真的有很好的理由,否则我不会推荐它。 You can opt to simply customize the default theme.您可以选择简单地自定义默认主题。 It is just a form anyway, after that the user can be immediately redirected to your app.无论如何,它只是一个表单,之后用户可以立即重定向到您的应用程序。

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

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