- 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.
推薦閱讀
- 云原生安全:攻防實踐與體系構建
- 黑客大曝光:無線網絡安全(原書第3版)
- 黑客攻防與無線安全從新手到高手(超值版)
- 網絡運維親歷記 (網絡運維紀實文學)
- Testing and Securing Android Studio Applications
- 信息安全案例教程:技術與應用(第2版)
- 信息安全等級保護測評與整改指導手冊
- 編譯與反編譯技術實戰
- Mastering Metasploit
- INSTANT Kali Linux
- 云計算安全技術與應用
- 從實踐中學習Nmap滲透測試
- 社會工程:防范釣魚欺詐(卷3)
- ATT&CK與威脅獵殺實戰
- INSTANT Microsoft Forefront UAG Mobile Configuration Starter