【问题标题】:Wicket authentication error following exampleWicket 身份验证错误如下示例
【发布时间】:2015-08-02 20:46:21
【问题描述】:

我正在学习检票口并尝试基于流动策略实现身份验证

Example

我创建了MyAuthenticatedWebApplication 类和MyAuthenticatedWebSession 以及所有其他组件,但是当我尝试转到MySignInPage 时,我得到了这个错误。

最后一个原因:org.apache.wicket.protocol.http.WebSession 不能转换为 org.apache.wicket.authroles.authentication.AuthenticatedWebSession WicketMessage:附加此容器进行渲染时出错:[Page class= com.myapp.wicket.SignInPage, id = 3, render count = 1]

有人可以帮忙吗?

【问题讨论】:

  • 你确定你的 web 应用程序类中有这个吗? protected Class<? extends AbstractAuthenticatedWebSession> getWebSessionClass() { return MyAuthenticatedWebSession.class; }
  • 是的,我的应用程序类中有这个,问题可能是因为我的应用程序类在不同的文件夹中
  • getWebSessionClass()里面放一个断点,看是否被调用/使用。

标签: java authentication wicket


【解决方案1】:

代替

@Override
protected Class<? extends AbstractAuthenticatedWebSession > getWebSessionClass() {
    return BasicAuthenticationSession.class;
}

尝试使用

@Override
protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
    return BasicAuthenticationSession.class;
}

【讨论】:

    【解决方案2】:

    解决方案
    当你定义一个扩展 AuthenticatedWebApplication 的类时,你没有任何方法:

    protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
        return BasicAuthenticationSession.class; }
    

    所以你不能重写那个方法。

    背景
    我遇到了同样的问题,但上面的解决方案不起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-18
      相关资源
      最近更新 更多