Resin的自定义认证

发布于 2024-12-14 07:24:38 字数 1750 浏览 7 评论 0原文

我很高兴 stackoverflow 的存在至少还有流量。很抱歉在这里问这些问题,但在 caucho 论坛上发布问题显然需要几周时间才能出现。

我正在阅读一份指南,为我的服务提供自定义登录表单,但我猜该指南是为 Resin 第 1 版编写的,我正在开发第 4 版,并且有一些我不完全理解的自定义标签,甚至Resin 4 的文档有一些错误。

接下来是标签:

<login-config> <auth-method>FORM</auth-method> <form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page> </form-login-config>
<authenticator id='MyAuthenticator'/>
</login-config>

版本 4 标签已更改,但我不太明白“foo bar”的类比。我确实看过《拯救士兵瑞恩》电影,所以 Foobar 听起来有点不专业和误导。

<foo:MyAuthenticator>
    <foo:foo>bar</foo:foo>
  </foo:MyAuthenticator>

<resin:FormLogin form-login-page="/" form-error-page="/" />

我不完全确定,但 com.caucho.security.AbstractAuthenticator 文档中不存在 getUser() 方法。该方法称为 getPassworduser()。我知道,人都会犯错误,至少我会犯错误,而且会犯很多错误。

package com.foo;

    import com.caucho.security.AbstractAuthenticator;
    import com.caucho.security.PasswordUser;

    public class MyAuthenticator extends AbstractAuthenticator {
      private PasswordUser _user;

      public MyAuthenticator()
      {
        _user = new PasswordUser("harry", "quidditch",
                                 new String[] { "user" });
      }

      public PasswordUser getUser(String userName)
      {
        if (userName.equals(_user.getName()))
          return _user;
        else
          return null;
      }
    }

那么,有人可以帮我解释一下新的标签语法吗? 如果我的包名为 com.subpackage1.subpackage2 怎么办? 什么代表“bar”元素? 什么是第一位的? ... 考虑到它们都是单独的标签,如何将我的表单链接到验证器?

I'm glad stackoverflow exists at least there is traffic. Sorry for asking these here but posting a question in caucho forums takes weeks to appear apparently.

I was fallowing a guide to have a custom login form for my service, but the guide was written for Resin version 1 I guess, and I'm working on version 4 and there are some custom tags that I don't fully understand and even the documentation for Resin 4 has some errors.

The tags are the next ones:

<login-config> <auth-method>FORM</auth-method> <form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page> </form-login-config>
<authenticator id='MyAuthenticator'/>
</login-config>

Version 4 tags where changed but I don't quite understand the "foo bar" analogy. I did watch Rescuing Soldier Ryan movie so Foobar sounds a little unprofessional and misleading.

<foo:MyAuthenticator>
    <foo:foo>bar</foo:foo>
  </foo:MyAuthenticator>

<resin:FormLogin form-login-page="/" form-error-page="/" />

I'm not totally sure but he getUser() method doesn't exists in the com.caucho.security.AbstractAuthenticator documentation. The method is called getPassworduser(). I know, people make mistakes, at least I have, and a lot.

package com.foo;

    import com.caucho.security.AbstractAuthenticator;
    import com.caucho.security.PasswordUser;

    public class MyAuthenticator extends AbstractAuthenticator {
      private PasswordUser _user;

      public MyAuthenticator()
      {
        _user = new PasswordUser("harry", "quidditch",
                                 new String[] { "user" });
      }

      public PasswordUser getUser(String userName)
      {
        if (userName.equals(_user.getName()))
          return _user;
        else
          return null;
      }
    }

So, can someone be so kind to explain me a little bit the new tag syntax?
What if my package is called com.subpackage1.subpackage2?
what represents the "bar" element?
What comes first? <resin:FormLogin ...> or <foo:MyAuthenticator>...</foo:MyAuthenticator>
How can I link my form to the authenticator considering that they are both separate tags?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情独悲 2024-12-21 07:24:38

好的,感谢那些阅读并尝试回答的人。我刚刚找到了一篇关于resin 4 迁移的非常有用的文档。链接位于此处。基本上我必须在网络应用程序标签中设置我自己的路径,如下所示:

<web-app xmlns="http://caucho.com/ns/resin" xmlns:mycustomtag="urn:java:com.my.package">

然后我只需使用如下标签:

<mycustomtag:MyClass>
  <mycustomtag:customAttribute>someAtributte
  </mycustomtag:customAttribute>
</mycustomtag:MyClass>

我希望这对某人有用,请表达你的爱并通过投票我的答案来给我竖起大拇指。

Ok, thank you to those who read it and maybe try to answer. I just found a very useful document on the resin 4 migration. The link is here. Basically I have to set my own path in the web-app tag like these:

<web-app xmlns="http://caucho.com/ns/resin" xmlns:mycustomtag="urn:java:com.my.package">

then I just use the tag like these:

<mycustomtag:MyClass>
  <mycustomtag:customAttribute>someAtributte
  </mycustomtag:customAttribute>
</mycustomtag:MyClass>

I hope this is useful for someone, please show your love and give me a thumbs up by voting my answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文