上QQ阅读APP看书,第一时间看更新
The default user schema of Spring Security
Let's take a look at each of the SQL files used to initialize the database. The first script we added contains the default Spring Security schema definition for users and their authorities. The following script has been adapted from Spring Security's Reference, which is listed in the Appendix, Additional Reference Material to have explicitly named constraints, to make troubleshooting easier:
//src/main/resources/database/h2/security-schema.sql
create table users(
username varchar(256) not null primary key,
password varchar(256) not null,
enabled boolean not null
);
create table authorities (
username varchar(256) not null,
authority varchar(256) not null,
constraint fk_authorities_users
foreign key(username) references users(username)
);
create unique index ix_auth_username on authorities (username,authority);