Spring Security ACLs use configuration and database scripts for Oracle databases

Source: Internet
Author: User

The Hsql script for the security ACL is only given on the official document of spring security, but spring did not explicitly give the database creation script and configuration instructions when using the Oracle database. The following are the SQL scripts and configurations that you use when you use the Oracle database

The SQL script is as follows

----------------------------------------------------------Create sequences------------------------------------- -------------------CREATE SEQUENCE "Acl_class_seq" INCREMENT by 1 MAXVALUE 9999999999999999999999999999 START with 1 Cach E Noorder nocycle; CREATE SEQUENCE "Acl_entry_seq" INCREMENT by 1 MAXVALUE 9999999999999999999999999999 START with 1 CACHE noorder ; CREATE SEQUENCE "Acl_object_identity_seq" INCREMENT by 1 MAXVALUE 9999999999999999999999999999 START with 1 CACHE Noord ER nocycle; CREATE SEQUENCE "Acl_sid_seq" INCREMENT by 1 MAXVALUE 9999999999999999999999999999 START with 1 CACHE noorder; ----------------------------------------------------------Acl_class Table-------------------------------------- ------------------CREATE TABLE "Acl_class" ("id" number (19,0) NOT NULL, "CLASS" VARCHAR2 () is not NULL, PRIMARY KEY ("id "), CONSTRAINT" Acl_class_class_uq "UNIQUE (" CLASS ")) tablespace &TSDATA; ----------------------------------------------------------Acl_entry table--------------------------------------------------------CREATE table "Acl_entry" ("ID" Number (19,0) NOT NULL, "acl_object_identity" number (19,0) is not null, "Ace_order" number (19,0) is not null, "SID" Number (19,0) Not null, ' MASK ' number (19,0) NOT NULL, ' granting ' number (1,0) not null, ' audit_success ' number (1,0) NOT NULL, "Audit_fail URE "Number (1,0) not NULL, PRIMARY KEY (" ID "), CONSTRAINT" Acl_entry_ident_order_uq "UNIQUE (" acl_object_identity "," Ace_ Order ") Tablespace &TSDATA; ALTER TABLE "Acl_entry" ADD CONSTRAINT "Acl_entry_granting_ck" CHECK ("granting" in (1,0)); ALTER TABLE "Acl_entry" ADD CONSTRAINT "Acl_entry_audit_success_ck" CHECK ("Audit_success" in (1,0)); ALTER TABLE "Acl_entry" ADD CONSTRAINT "Acl_entry_audit_failure_ck" CHECK ("Audit_failure" in (1,0)); ----------------------------------------------------------Acl_object_identity Table---------------------------- ----------------------------CREATE TABLE "acl_object_identity" ("ID" NUMBER (19,0) NOT NULL, "Object_id_class" number (19,0) is not null, "object_id_identity" number (19,0) is not null, "Parent_object" NU Mber (19,0), "Owner_sid" number (19,0) NOT NULL, "entries_inheriting" number (1,0) is not NULL, PRIMARY KEY ("ID"), CONSTRAINT " Acl_obj_id_class_ident_uq "UNIQUE (" Object_id_class "," object_id_identity ")) tablespace &TSDATA; ALTER TABLE "acl_object_identity" ADD CONSTRAINT "Acl_obj_id_entries_ck" CHECK ("entries_inheriting" in (1,0)); ----------------------------------------------------------Acl_sid Table---------------------------------------- ----------------CREATE TABLE "Acl_sid" ("ID" number (19,0) NOT NULL, "PRINCIPAL" number (1,0) is not null, "SID" VARCHAR2 (100 Not NULL, PRIMARY KEY ("ID"), CONSTRAINT "Acl_sid_principal_sid_uq" UNIQUE ("SID", "PRINCIPAL") tablespace &TSDATA; ALTER TABLE "Acl_sid" ADD CONSTRAINT "Acl_sid_principal_ck" CHECK ("PRINCIPAL" in (1,0)); ----------------------------------------------------------Relationships--------------------------------------------------------ALTER TABLE "acl_entry" ADD CONSTRAINT "fk_acl_entry_acl_object_id" FOREIGN KEY (" Acl_object_identity ") REFERENCES" Acl_object_identity "(" ID "); ALTER TABLE "Acl_entry" ADD CONSTRAINT "Fk_acl_entry_sid" FOREIGN KEY ("SID") REFERENCES "Acl_sid" ("ID"); ALTER TABLE "acl_object_identity" ADD CONSTRAINT "Fk_acl_obj_id_class" FOREIGN KEY ("Object_id_class") REFERENCES "Acl_" CLASS "(" ID "); ALTER TABLE "acl_object_identity" ADD CONSTRAINT "Fk_acl_obj_id_parent" FOREIGN KEY ("Parent_object") REFERENCES "Acl_" Object_identity "(" ID "); ALTER TABLE "acl_object_identity" ADD CONSTRAINT "Fk_acl_obj_id_sid" FOREIGN KEY ("Owner_sid") REFERENCES "Acl_sid" ("ID" ); ----------------------------------------------------------Triggers--------------------------------------------- -----------CREATE OR REPLACE TRIGGER "acl_class_id" before INSERT on Acl_class for each ROW BEGIN SELECT acl_class_seq. Nextval INTO:new.id from dual; End; /CREATE OR REPLACE TRIGGER "Acl_entry_ID "before INSERT on acl_entry for each ROW BEGIN SELECT acl_entry_seq. Nextval INTO:new.id from dual; End; /CREATE OR REPLACE TRIGGER "acl_object_identity_id" before INSERT on acl_object_identity for each ROW BEGIN SELECT acl_ob Ject_identity_seq. Nextval INTO:new.id from dual; End; /CREATE OR REPLACE TRIGGER "acl_sid_id" before INSERT on Acl_sid for each ROW BEGIN SELECT acl_sid_seq. Nextval INTO:new.id from dual; End; / 

The spring configuration fragment is 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 ACL_CLASS_ Seq.currval from dual "/> <beans:property name=" sididentityquery "value=" select Acl_sid_seq.currval from Dual " > </beans:bean>

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.