(七)、SpringBoot + SpringSecurity 简单登录认证

可以前往第一篇博客查看目录结构 --> 这里

一、查看是否依赖Spring Security相关jar包(例如: spring-boot-starter-security) ,修改demo模块下的 application.propertiies(打开spring security认证)

//注释掉这段配置,开启springsecurity
#security.basic.enabled=false

二、编写简单的html登录页面,放在browser模块下的 src -> main -> resources -> resources -> zeke-login.html

(表单提交地址是:/authentication/form   待会需要用到)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Login Page</title>
</head>
<body>
<form action="/authentication/form" method="post">
    <table>
        <tr>
            <td>用户名:</td>
            <td><input type="text" name="username"/></td>
        </tr>
        <tr>
            <td>密码:</td>
            <td><input type="password" name="password"/></td>
        </tr>
        <tr>
            <td colspan="2"><button type="submit">登录</button></td>
        </tr>
    </table>
</form>
</body>
</html>

三、在browser模块 src->main->java->com->zeke->browser新建support目录,创建简单的返回值类

public class SimpleResponse {

    private Object content;

    public SimpleResponse(Object content) {
        this.content = content;
    }

    public Object getContent() {
        return co
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值