書名: Hands-On Spring Security 5 for Reactive Applications作者名: Tomcy John本章字數: 159字更新時間: 2021-07-23 18:59:21
Step 3—MySQL database schema setup
Create a default database schema using the following scripts, and insert some users:
create table users(
username varchar(75) not null primary key,
password varchar(150) not null,
enabled boolean not null
);
create table authorities (
username varchar(75) not null,
authority varchar(50) not null,
constraint fk_authorities_users foreign key(username) references users(username)
);
Insert data into the preceding tables using the following scripts:
insert into users(username, password, enabled)
values('admin', '$2a$04$lcVPCpEk5DOCCAxOMleFcOJvIiYURH01P9rx1Y/pl.wJpkNTfWO6u', true);
insert into authorities(username, authority)
values('admin','ROLE_ADMIN');
insert into users(username, password, enabled)
values('user', '$2a$04$nbz5hF5uzq3qsjzY8ZLpnueDAvwj4x0U9SVtLPDROk4vpmuHdvG3a', true);
insert into authorities(username,authority)
values('user','ROLE_USER');
The password is one-way hashed using online tool http://www.devglan.com/online-tools/bcrypt-hash-generator. To compare the password we will use PasswordEncoder (Bcrypt).
Credentials are as follows:
- User = admin and password = admin@password
- User = user and password = user@password
It's important to note that, even though the role is named ROLE_ADMIN, the actual name is ADMIN, and this is what our code will be using while passing.
推薦閱讀
- INSTANT Netcat Starter
- Kali Linux CTF Blueprints
- Practical Network Scanning
- 暗戰亮劍:黑客滲透與防御全程實錄
- .NET安全攻防指南(上冊)
- 數字化轉型浪潮下的數據安全最佳實踐指南
- Computer Forensics with FTK
- Learning Devise for Rails
- 計算機網絡安全技術研究
- 隱私計算
- Falco云原生安全:Falco原理、實踐與擴展
- 隱私保護機器學習
- INSTANT Microsoft Forefront UAG Mobile Configuration Starter
- 2010年中國互聯網網絡安全報告
- 反黑風暴:黑客社會工程學攻防演練