【问题标题】:How to incorporate Spring security using open id into a GWT project如何将使用开放 ID 的 Spring 安全性合并到 GWT 项目中
【发布时间】:2010-03-03 06:26:23
【问题描述】:

它很简单,基本上我想遵循 GWT 的“一页”范式,并将 Spring 安全性集成到应用程序中。 我的理解是,如果在系统中找不到 cookie,spring 会将用户重定向到 Open id referrer 页面,要求登录,否则它只会向我的服务器发送用户的 open url id。

这是我在 GWT 中尝试的:

        final FormPanel formPanel = new FormPanel();
        RootPanel.get("openId").add(formPanel);
        VerticalPanel openIdContainer = new VerticalPanel();
        formPanel.add(openIdContainer);

        TextBox url = new TextBox();
        url.setText("https://www.google.com/accounts/o8/id");
        url.setName("j_username");
        openIdContainer.add(url);

        formPanel.setAction("j_spring_openid_security_check");
        formPanel.setMethod(FormPanel.METHOD_POST);

        Button btn = new Button("Open ID");
        btn.addClickListener(new ClickListener() {
            public void onClick(Widget sender)
            {
                formPanel.submit();
            }
        });
        openIdContainer.add(btn);        

        formPanel.addFormHandler(new FormHandler() {
            public void onSubmit(FormSubmitEvent event)
            {
                System.out.println("On Submit invoked " +event.isCancelled());
            }
            public void onSubmitComplete(FormSubmitCompleteEvent event)
            {
                System.out.println("On Submit Complete invoked " + event.toString());
            }

        });

相应的输出: 提交时调用 false 在提交完成时调用 null

据我了解,收到的 html 为空。我还应该怎么做? GWT 1.5 没有简单的表单(确实会在提交时刷新页面)和类型为提交的输入标记。 我是否必须将其硬编码到 HTML 小部件中? 我尝试设置另一个框架作为此表单面板的目标,但仍然无法获得任何富有成效的结果。

【问题讨论】:

    标签: html gwt openid spring-security form-submit


    【解决方案1】:

    据我所知,您没有设置正确的上传 URL:

    formPanel.setAction(uploadServiceUrl);

    /**
       * Sets the 'action' associated with this form. This is the URL to which it
       * will be submitted.
       * 
       * @param url the form's action
       */
      public void setAction(String url) {
        getFormElement().setAction(url);
      }
    

    【讨论】:

    • 请澄清一下,您的意思是“j_spring_openid_security_check”作为我的表单的操作不正确吗?它是一个标准的 spring 安全目标 url 帖子。我怀疑它错了。
    • 我不熟悉 Spring 或 OpenId,但我怀疑 GWT 是否将其发布到正确的 URL。使用 FireBug 检查您的 POST 请求的去向以及实际发送的内容。
    猜你喜欢
    • 2013-11-18
    • 1970-01-01
    • 2012-02-14
    • 1970-01-01
    • 2012-09-01
    • 2017-07-17
    • 2022-06-27
    • 1970-01-01
    • 2015-12-07
    相关资源
    最近更新 更多