1

我想在检票口中进行 weblogic 表单验证,但我不知道如何创建登录页面。我遵循了本教程,其中 jsp 中的示例:

http://docs.oracle.com/cd/E13222_01/wls/docs100/security/thin_client.html#wp1057581

我在检票口中创建了类似的表格,但我不知道按下提交按钮时应该做什么。有一些名为“j_security_check”的动作,但我不知道我应该如何在 java 和 wicket 中实现它

更新:我正在使用 weblogic 10.something 并且我不能使用最新的我尝试创建自己的 impelemtation 但是当我尝试使用登录检票口抛出异常时:

java.lang.NoSuchMethodError: javax/servlet/http/HttpServletRequest.login(Ljava/lang/String;Ljava/lang/String;)V.

我应该在我的 web.xml 中添加 servlet 吗?

更新2:

我在我的项目中的答案中添加了表单,当我按下密码错误的提交按钮时,会出现 url: http://localhost:8080/application/j_security_checkwith status 404 not found。当我添加正确的通行证时,有 url: 也http://localhost:8080/application/admin有状态 404

网页.xml:

<security-constraint>

    <web-resource-collection>
        <web-resource-name>application</web-resource-name>
        <url-pattern>/admin</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>a</role-name>
    </auth-constraint>
</security-constraint>

<security-role>
    <role-name>a</role-name>
</security-role>

<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login</form-login-page>
        <form-error-page>/login</form-error-page>
    </form-login-config>
</login-config>

更新 3:我找到了这个例子:https://cwiki.apache.org/WICKET/servlet-container-authentication.html我想要的在哪里,但使用的是 wicket 1.4,但我使用的是 wicket 1.5。并且有很多未知的类,但也许有人可以将其重写为 wicket 的 1.5 版本

4

2 回答 2

2
1. You missed security realm name in your web.xml
<login-config>
<auth-method>FORM</auth-method>
<realm-name>myrealm</realm-name>
<form-login-config>
.....
</login-config>
The realm-name must match the security realm setup in Weblogic (myrealm is the WebLogic default)

2. You missed the weblogic.xml
in your web.xml you defined one security role called <a>, you need map Weblogic Group to the role, such as 
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">    
<security-role-assignment>
<role-name>a</role-name>
<principal-name>weblogic</principal-name>
</security-role-assignment>
</weblogic-web-app>
Please put webloigc.xml in WEB-INF folder
于 2012-08-17T12:25:45.517 回答
1

I don't know if your project is already at an advanced stage, or if it is hard to migrate/use your code to/in another wicket project - I suggest you use an existing framework to do that, like Shiro (http://shiro.apache.org/index.html) which is very cool.

Apache Shiro is a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management. With Shiro’s easy-to-understand API, you can quickly and easily secure any application – from the smallest mobile applications to the largest web and enterprise applications.

If you want to use this in Wicket I suggest you pickup the 55minutes project (https://github.com/55minutes/fiftyfive-wicket), which works with Shiro.

The 55 Minutes Wicket project is a set of tools and libraries we use for enhancing our productivity with the Apache Wicket Java web framework. We've made our code available as open source to share with the Wicket community.

In 55minutes login screens are already built, and all you have to do is define the access configurations to the database where the login info/tables are at. Hope it helps. Regards

于 2012-08-14T15:53:11.910 回答