有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java在自定义KeyClope SPI验证器中处理用户的取消

我需要在自定义KeyClope SPI验证器中处理用户的取消。 我实现了它,效果很好。所有我需要的是取消登录流,并从乞讨开始,当用户点击取消

    @Override
    public void action(AuthenticationFlowContext context) {
        logger.debug("action called ... context = " + context);
        String cancel = context.getHttpRequest().getDecodedFormParameters().getFirst("cancel");
        if (cancel != null) {
            context.cancelLogin();
            context.resetFlow();
            return;
        }
// OK handling...
}

在我的情况下,我得到的是登录页面,但URL错误:

http://localhost:8080/auth/realms/realm1/login-actions/authenticate?execution=bb1fb7c3-0b59-4a07-b997-b619c6f9ea2a&client_id=realm1-client&tab_id=YJxYk7osJaU

当我第一次进入安全页面时,不是这样的URL:

http://localhost:8080/auth/realms/realm1/protocol/openid-connect/auth?response_type=code&client_id=realm1-client&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fsso%2Flogin&state=2cc038b9-2c69-4648-ac39-e5864bc05ee9&login=true&scope=openid


共 (1) 个答案

  1. # 1 楼答案

    啊,我所需要的就是只留下一行(或者在返回之前放在最后一行):

    context.cancelLogin();
    

    在我的自定义应用程序上,我需要使用KK将重定向给我的参数来处理端点

    /sso/login?error=access_denied&state=923e5b18-1d8e-4c96-9fed-c1dd122065bb