上QQ阅读APP看书,第一时间看更新
Utilizing GBAC JDBC scripts
Next, we need to update the scripts that are being loaded at startup. We need to remove the security-user-authorities.sql mapping so that our users no longer obtain their authorities with direct mapping. We then need to add two additional SQL scripts. Update the DataSource bean configuration to load the SQL required for GBAC, as follows:
//src/main/java/com/packtpub/springsecurity/configuration/DataSourceConfig.java
@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setName("dataSource")
.setType(EmbeddedDatabaseType.H2)
.addScript("/database/h2/calendar-schema.sql")
.addScript("/database/h2/calendar-data.sql")
.addScript("/database/h2/security-schema.sql")
.addScript("/database/h2/security-users.sql")
.addScript("/database/h2/security-groups-schema.sql")
.addScript("/database/h2/security-groups-mappings.sql")
.build();
}