In the official Spring Security documents, only the security ACL hsql script is provided. However, spring does not explicitly provide the database creation script and configuration instructions when using the MySQL database, the following are the SQL scripts and configurations used when you use the MySQL database.
The SQL script is as follows:
- Create table 'acl _ class '(
- 'Id' bigint (20) Not null auto_increment,
- 'Class' varchar (100) Not null,
- Primary key ('id '),
- Unique key 'unique _ UK_2 '('class ')
- ) ENGINE = InnoDB default charset = latin1 AUTO_INCREMENT =1;
- Create table 'acl _ entry '(
- 'Id' bigint (20) Not null auto_increment,
- 'Acl _ OBJECT_IDENTITY 'bigint (20) Not null,
- 'Ace _ order'Int(11) Not null,
- 'Sid 'bigint (20) Not null,
- 'Mask'Int(11) Not null,
- 'Granting' tinyint (1) Not null,
- 'Audit _ SUCCESS 'tinyint (1) Not null,
- 'Audit _ FAILURE 'tinyint (1) Not null,
- Primary key ('id '),
- Unique key 'unique _ UK_4 '('acl _ OBJECT_IDENTITY', 'ace _ Order '),
- KEY 'sid '('sid ')
- ) ENGINE = InnoDB default charset = latin1 AUTO_INCREMENT =1;
- Create table 'acl _ object_identity '(
- 'Id' bigint (20) Not null auto_increment,
- 'Object _ ID_CLASS 'bigint (20) Not null,
- 'Object _ ID_IDENTITY 'bigint (20) Not null,
- 'Parent _ object' bigint (20)DefaultNULL,
- 'Owner _ Sid' bigint (20)DefaultNULL,
- 'Entries _ INHERITING 'tinyint (1) Not null,
- Primary key ('id '),
- Unique key 'unique _ UK_3 '('object _ ID_CLASS', 'object _ ID_IDENTITY '),
- KEY 'owner _ SID '('owner _ SID '),
- KEY 'parent _ object' ('parent _ object ')
- ) ENGINE = InnoDB default charset = latin1 AUTO_INCREMENT =1;
- Create table 'acl _ sid '(
- 'Id' bigint (20) Not null auto_increment,
- 'Prinal al' tinyint (1) Not null,
- 'Sid' varchar (100) Not null,
- Primary key ('id '),
- Unique key 'unique _ UK_1 '('prinal al', 'sid ')
- ) ENGINE = InnoDB default charset = latin1;
The spring configuration snippets are as follows:
- <Beans: bean Id="AclService" Class="Org. springframework. security. acls. jdbc. JdbcMutableAclService">
- <Beans: constructor-arg Ref="DataSource" />
- <Beans: constructor-arg Ref="LookupStrategy" />
- <Beans: constructor-arg Ref="AclCache" />
- <Beans: property Name="ClassIdentityQuery" Value="SELECT @ IDENTITY"/>
- <Beans: property Name="SidIdentityQuery" Value="SELECT @ IDENTITY"/>
- </Beans: bean>