日期:2014-05-16  浏览次数:20572 次

Spring—Acegi系统安全—身份证管理—基于数据库存储用户信息认证

//数据库脚本:mysql.sql

DROP DATABASE IF EXISTS sampledb;

CREATE DATABASE sampledb DEFAULT CHARACTER SET utf8;

USE sampledb;

CREATE TABLE T_USER (

?? USER_ID INTEGER NOT NULL AUTO_INCREMENT,

?? USERNAME VARCHAR(30) NOT NULL,

?? PASSWORD VARCHAR(30) DEFAULT NULL,

?? STATUS TINYINT(1) NOT NULL DEFAULT '0',

?? PRIMARY KEY (`USER_ID`),

?? UNIQUE KEY `USERNAME` (`USERNAME`)

);

CREATE TABLE T_USER_PRIV (

? USER_ID INTEGER NOT NULL DEFAULT '0',

? PRIV_NAME VARCHAR(30) DEFAULT NULL,

? PRIMARY KEY (USER_ID, PRIV_NAME)

);

?

INSERT INTO T_USER (USER_ID, USERNAME, PASSWORD, STATUS) VALUES

? (1,'tom','tom',1),

? (2,'john','john',1);

?