Skip to content

Instantly share code, notes, and snippets.

@cbmeeks
Created October 16, 2012 14:28
Show Gist options
  • Save cbmeeks/3899595 to your computer and use it in GitHub Desktop.
Save cbmeeks/3899595 to your computer and use it in GitHub Desktop.
User Table for Spring Security
/* Once the users table is created, you can add users with the SQL below. NOTE, we are using SHA1 in this example and cAsE matters */
/* New User:
Username: moehoward
Password: nyucknyuck
NOTICE: Inside the 'sha1', the string is: password{username}
In Spring, we told it to use a salt source of 'username'. But you HAVE to put it in the curly brackets. So, try not to have curly brackets in your password. :-)
*/
insert into users (username, password, enabled, firstname, lastname) values ('moehoward', sha1('nyucknyuck{moehoward}'), 1, 'Moe', 'Howard');
CREATE TABLE `users` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(64) NOT NULL,
`password` VARCHAR(128) NULL DEFAULT NULL,
`enabled` TINYINT(1) UNSIGNED NULL DEFAULT '1',
`firstname` VARCHAR(64) NOT NULL,
`lastname` VARCHAR(64) NOT NULL,
PRIMARY KEY (`id`),
INDEX `username` (`username`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
ROW_FORMAT=DEFAULT
AUTO_INCREMENT=3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment