Spring Security ACL uses MySQL configuration and database scripts

Source: Internet
Author: User

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:

  1. Create table 'acl _ class '(
  2. 'Id' bigint (20) Not null auto_increment,
  3. 'Class' varchar (100) Not null,
  4. Primary key ('id '),
  5. Unique key 'unique _ UK_2 '('class ')
  6. ) ENGINE = InnoDB default charset = latin1 AUTO_INCREMENT =1;
  7. Create table 'acl _ entry '(
  8. 'Id' bigint (20) Not null auto_increment,
  9. 'Acl _ OBJECT_IDENTITY 'bigint (20) Not null,
  10. 'Ace _ order'Int(11) Not null,
  11. 'Sid 'bigint (20) Not null,
  12. 'Mask'Int(11) Not null,
  13. 'Granting' tinyint (1) Not null,
  14. 'Audit _ SUCCESS 'tinyint (1) Not null,
  15. 'Audit _ FAILURE 'tinyint (1) Not null,
  16. Primary key ('id '),
  17. Unique key 'unique _ UK_4 '('acl _ OBJECT_IDENTITY', 'ace _ Order '),
  18. KEY 'sid '('sid ')
  19. ) ENGINE = InnoDB default charset = latin1 AUTO_INCREMENT =1;
  20. Create table 'acl _ object_identity '(
  21. 'Id' bigint (20) Not null auto_increment,
  22. 'Object _ ID_CLASS 'bigint (20) Not null,
  23. 'Object _ ID_IDENTITY 'bigint (20) Not null,
  24. 'Parent _ object' bigint (20)DefaultNULL,
  25. 'Owner _ Sid' bigint (20)DefaultNULL,
  26. 'Entries _ INHERITING 'tinyint (1) Not null,
  27. Primary key ('id '),
  28. Unique key 'unique _ UK_3 '('object _ ID_CLASS', 'object _ ID_IDENTITY '),
  29. KEY 'owner _ SID '('owner _ SID '),
  30. KEY 'parent _ object' ('parent _ object ')
  31. ) ENGINE = InnoDB default charset = latin1 AUTO_INCREMENT =1;
  32. Create table 'acl _ sid '(
  33. 'Id' bigint (20) Not null auto_increment,
  34. 'Prinal al' tinyint (1) Not null,
  35. 'Sid' varchar (100) Not null,
  36. Primary key ('id '),
  37. Unique key 'unique _ UK_1 '('prinal al', 'sid ')
  38. ) ENGINE = InnoDB default charset = latin1;

The spring configuration snippets are as follows:

  1. <Beans: bean Id="AclService" Class="Org. springframework. security. acls. jdbc. JdbcMutableAclService">
  2. <Beans: constructor-arg Ref="DataSource" />
  3. <Beans: constructor-arg Ref="LookupStrategy" />
  4. <Beans: constructor-arg Ref="AclCache" />
  5. <Beans: property Name="ClassIdentityQuery" Value="SELECT @ IDENTITY"/>
  6. <Beans: property Name="SidIdentityQuery" Value="SELECT @ IDENTITY"/>
  7. </Beans: bean>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.