Keycloak预重定向逻辑

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

Keycloak pre-redirect logic

问题

我正在研究在我的Spring Boot服务器中使用Keycloak,似乎每当您访问受Keycloak保护的端点时,它都会自动重定向到登录界面。

我的问题是,是否有可能在决定重定向到Keycloak登录页面之前对请求进行控制?

我可以先访问一个未受保护的端点,然后进行一些逻辑,然后手动重定向到受保护的端点,但也许有一种更好的内置方式?

英文:

I'm looking into using Keycloak with my Spring Boot server and it seems like whenever you navigate to an endpoint protected by Keycloak, it will automatically redirect to a login screen.

My question is, is it possible to get a control on the request before deciding to redirect to the Keycloak login page?

I could first hit an unprotected endpoint first, do some logic then redirect manually to the protected one but perhaps there is a better built in way?

答案1

得分: 0

我不知道您确切需要实现什么,所以我只能提供模糊的回答。

  • 如果Keycloak提供的“action”与您的需求匹配,您可以将所需的“action”添加到认证流程中。

  • 如果需要,您可以定义新的必需操作

  • 您可以修改登录页面模板并执行一些JavaScript代码,以提取您想要获取的信息。

  • 您还可以全程参与并实现自己的认证SPI,以实现任何所需操作。

英文:

I don't know what you need to achieve exactly so I can only answer vaguely.

  • You could add the "action" you need to the authentication flow, if the "action" Keycloak provides match your need.

  • You can define new required actions if needed.

  • You can modify the login page template and execute some javascript to extract the information you want to grab.

  • You can go all the way and implement your own authentication SPI and do whatever you wish to do.

huangapple
  • 本文由 发表于 2020年9月11日 08:36:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/63839323.html
匿名

发表评论

匿名网友

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

确定