Spring Security ACL使用MySQL配置與資料庫指令碼

來源:互聯網
上載者:User

在Spring Security的官方文檔上面只給出了關於security ACL的hsql指令碼,但是在使用MySQL資料庫時spring沒有明確給出資料庫建立指令碼和配置說明,以下是自己在使用MySQL資料庫時使用到的sql指令碼和配置

sql指令碼如下

CREATE TABLE `acl_class` (<br /> `ID` bigint(20) NOT NULL auto_increment,<br /> `CLASS` varchar(100) NOT NULL,<br /> PRIMARY KEY (`ID`),<br /> UNIQUE KEY `UNIQUE_UK_2` (`CLASS`)<br />) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />CREATE TABLE `acl_entry` (<br /> `ID` bigint(20) NOT NULL auto_increment,<br /> `ACL_OBJECT_IDENTITY` bigint(20) NOT NULL,<br /> `ACE_ORDER` int(11) NOT NULL,<br /> `SID` bigint(20) NOT NULL,<br /> `MASK` int(11) NOT NULL,<br /> `GRANTING` tinyint(1) NOT NULL,<br /> `AUDIT_SUCCESS` tinyint(1) NOT NULL,<br /> `AUDIT_FAILURE` tinyint(1) NOT NULL,<br /> PRIMARY KEY (`ID`),<br /> UNIQUE KEY `UNIQUE_UK_4` (`ACL_OBJECT_IDENTITY`,`ACE_ORDER`),<br /> KEY `SID` (`SID`)<br />) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />CREATE TABLE `acl_object_identity` (<br /> `ID` bigint(20) NOT NULL auto_increment,<br /> `OBJECT_ID_CLASS` bigint(20) NOT NULL,<br /> `OBJECT_ID_IDENTITY` bigint(20) NOT NULL,<br /> `PARENT_OBJECT` bigint(20) default NULL,<br /> `OWNER_SID` bigint(20) default NULL,<br /> `ENTRIES_INHERITING` tinyint(1) NOT NULL,<br /> PRIMARY KEY (`ID`),<br /> UNIQUE KEY `UNIQUE_UK_3` (`OBJECT_ID_CLASS`,`OBJECT_ID_IDENTITY`),<br /> KEY `OWNER_SID` (`OWNER_SID`),<br /> KEY `PARENT_OBJECT` (`PARENT_OBJECT`)<br />) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />CREATE TABLE `acl_sid` (<br /> `ID` bigint(20) NOT NULL auto_increment,<br /> `PRINCIPAL` tinyint(1) NOT NULL,<br /> `SID` varchar(100) NOT NULL,<br /> PRIMARY KEY (`ID`),<br /> UNIQUE KEY `UNIQUE_UK_1` (`PRINCIPAL`,`SID`)<br />) ENGINE=InnoDB DEFAULT CHARSET=latin1;<br /> 

 

spring配置片段如下

<beans:bean id="aclService" class="org.springframework.security.acls.jdbc.JdbcMutableAclService"><br /><beans:constructor-arg ref="dataSource" /><br /><beans:constructor-arg ref="lookupStrategy" /><br /><beans:constructor-arg ref="aclCache" /></p><p><beans:property name="classIdentityQuery" value="SELECT @@IDENTITY"/><br /><beans:property name="sidIdentityQuery" value="SELECT @@IDENTITY"/><br /></beans:bean> 

 

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.