Java spring security,其中数据存储在服务器上
在浏览了SpringSecurity的一些链接之后,我了解了它是如何工作的。但我仍然不知道应该在spring-security.xml中提供哪个用户名和密码,因为我使用的是Java spring security,其中数据存储在服务器上,java,json,spring,spring-mvc,spring-security,Java,Json,Spring,Spring Mvc,Spring Security,在浏览了SpringSecurity的一些链接之后,我了解了它是如何工作的。但我仍然不知道应该在spring-security.xml中提供哪个用户名和密码,因为我使用的是JSON。我的所有数据都存储在服务器上。如果我登录到该页面,它将在服务器中检查该数据是否存在,如果存在,则应继续。如何使用spring安全性和身份验证来执行此操作?对此有任何帮助吗。。?这是我的spring-security.xml <http use-expressions="true"> <inter
JSON
。我的所有数据都存储在服务器上。如果我登录到该页面,它将在服务器中检查该数据是否存在,如果存在,则应继续。如何使用spring安全性和身份验证来执行此操作?对此有任何帮助吗。。?这是我的spring-security.xml
<http use-expressions="true">
<intercept-url pattern="/signin*" access="isAnonymous()" />
<intercept-url pattern="/**" access="isAuthenticated()"/>
<form-login
login-page='/signin'
default-target-url="/home"
authentication-failure-url="/signin?error=true"
login-processing-url="/security/j_spring_security_check"
/>
<logout logout-success-url="/signin" />
</http> and may be i have to add some ref in the authentication manager so that it will check the username and password which are present in the remote server..
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="user" />
</authentication-manager>
可能我必须在身份验证管理器中添加一些ref,以便它检查远程服务器中存在的用户名和密码。。
如果有一些链接或一些信息,那么请在您可以配置的服务器中帮助我(如果用户名和密码存储在数据库中)
或
表单登录
<form name='loginForm' action="<c:url value='/j_spring_security_check' />" method='POST'>
<table>
<tr>
<td>User:</td>
<td><input type='text' name='username'></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' name='password' /></td>
</tr>
<tr>
<td></td>
<td>
<input name="submit" type="submit" value="Login"/>
</td>
</tr>
</table>
</form>
用户:
密码:
你认为这会有帮助吗?你能告诉我应该在控制器中写些什么来进行授权吗?给我一些有用的提示或链接
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="123456" authorities="ROLE_USER" />
<user name="admin" password="123456" authorities="ROLE_ADMIN" />
<user name="dba" password="123456" authorities="ROLE_DBA" />
</user-service>
</authentication-provider>
</authentication-manager>
<form name='loginForm' action="<c:url value='/j_spring_security_check' />" method='POST'>
<table>
<tr>
<td>User:</td>
<td><input type='text' name='username'></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' name='password' /></td>
</tr>
<tr>
<td></td>
<td>
<input name="submit" type="submit" value="Login"/>
</td>
</tr>
</table>
</form>