Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Security 使用JSP和Websphere安全登录_Security_Jsp_Networking_Login_Websphere - Fatal编程技术网

Security 使用JSP和Websphere安全登录

Security 使用JSP和Websphere安全登录,security,jsp,networking,login,websphere,Security,Jsp,Networking,Login,Websphere,我正在用JSP设计一个安全登录。我打算使用表单授权来访问Websphere上的应用程序。其基本思想是,当域中经过身份验证的内部用户访问某个页面时,该页面将按照正常方式进行。但是,如果外部用户尝试访问它,它将引导他们进入登录页面,与Active Directory交互,并在正确的身份验证后将他们重定向到该页面 为了使它能够工作,我尝试修改Web.xml以允许使用内置的“j_security_check”servlet进行表单身份验证。登录后,它将通过一个简单的功能或按钮向用户“Hello,!”致意

我正在用JSP设计一个安全登录。我打算使用表单授权来访问Websphere上的应用程序。其基本思想是,当域中经过身份验证的内部用户访问某个页面时,该页面将按照正常方式进行。但是,如果外部用户尝试访问它,它将引导他们进入登录页面,与Active Directory交互,并在正确的身份验证后将他们重定向到该页面

为了使它能够工作,我尝试修改Web.xml以允许使用内置的“j_security_check”servlet进行表单身份验证。登录后,它将通过一个简单的功能或按钮向用户“Hello,!”致意

基于,我修改了我的Web.xml详细信息,如下所示:

<welcome-file-list>
    <welcome-file>/protected/index.jsp</welcome-file>
</welcome-file-list>

<security-constraint>
    <web-resource-collection>
        <url-pattern>/protected/*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
        <role-name>users</role-name>
    </auth-constraint>
</security-constraint>

<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>
</login-config>

<security-role>
    <description>Administrator</description>
    <role-name>admin</role-name>
</security-role>
<security-role>
    <description>Users</description>
    <role-name>users</role-name>
</security-role>

/protected/index.jsp
/保护/*
得到
邮递
这导致我尝试/尝试保护此身份验证过程


对于我所面临的前三个问题,我希望能得到一些指导和帮助。感觉我已经接近完成任务了,但距离如此之近,但到目前为止……

如果有人想知道,这个问题很容易通过配置解决

1) 在Web.xml中分配管理员和用户角色时,必须进入Websphere>.war>角色和用户>并按照Active Directory中的指定将管理员和用户角色物理分配给角色。这将使用户能够访问该页面

2) 同样,对于SPNEGO配置下的Websphere配置,必须将其附加到列表“|”以启用它,以便请求。此后,域中经过身份验证的用户将直接访问该项目,而外部用户将被重定向到登录页面。request.getPrincipalUser()现在可以工作了

3) 有一个Spring安全性示例可以使用。唯一的问题是它访问其ApplicationContextSecurity.xml中的本地身份验证提供程序而不是Active Directory。为保护频道,在
NONE
下,应将NONE替换为机密

<form action="j_security_check" method="post">
    Username: <input type="text" name="j_username">
    Password: <input type="password" name="j_password">
    <input type="submit" value="Login">
</form>
<body>
    Hello, <% request.getRemoteUser(); %>
    Hello, <% request.getUserPrincipal().getName(); %>
</body>