Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
spring安全性:密码更改页面实现_Spring_Spring Mvc_Spring Security - Fatal编程技术网

spring安全性:密码更改页面实现

spring安全性:密码更改页面实现,spring,spring-mvc,spring-security,Spring,Spring Mvc,Spring Security,我对spring和web开发一无所知。我想实现用户密码更改功能。到目前为止,我仅以这种方式使用路径: @RequestMapping(value = "/timetable/{year}/{month}/{date}", method = RequestMethod.GET) public String timetableDateJump(@PathVariable("year") int year, @PathVariable("month") int month..) 但我不希望用户的通行

我对spring和web开发一无所知。我想实现用户密码更改功能。到目前为止,我仅以这种方式使用路径:

@RequestMapping(value = "/timetable/{year}/{month}/{date}", method = RequestMethod.GET)
public String timetableDateJump(@PathVariable("year") int year, @PathVariable("month") int month..)
但我不希望用户的通行证只在url中传递。它是如何在web服务中实现的?正常情况是什么?为什么要实施


顺便说一句:对于coruse,我应该从用户tpo服务器传递密码,并在服务器端对其进行散列,对吗?

从我的角度来看,这里没有spring安全特定的详细信息:

1在视图中创建表单

<form:form method="post" action="/password/change" modelAttribute="changePasswordForm">
    <form:label path="password">
        New password:
    </form:label>
    <form:password path="password" />
    <input type="submit" value="Change password" />
</form:form>
3创建控制器

@Controller
public ChangePasswordController {

    @RequestMapping(value = "/password/change", method = RequestMethod.POST)
    public String changePassword(ChangePasswordForm form) {
        // change user password
        return "return:/user/info";
    }
}
我没有测试这段代码,但它应该以这种方式工作


如何更新数据库中的密码取决于您的应用程序和使用过的库。

您看过吗?是的,我看过-事实上,它涉及到如何强制重定向到用户页面更改,而不是如何实现更改。您还想了解什么?接受的答案有一个映射到HTTP POST的方法签名。您所需要做的就是填写如何实际更改密码,这将取决于保存用户ID和密码的数据存储。我也不太确定如何编写jsp页面,例如将用户密码从某个输入表单传递到http请求
@Controller
public ChangePasswordController {

    @RequestMapping(value = "/password/change", method = RequestMethod.POST)
    public String changePassword(ChangePasswordForm form) {
        // change user password
        return "return:/user/info";
    }
}