Last active
December 11, 2015 08:29
-
-
Save pikanji/4573845 to your computer and use it in GitHub Desktop.
Sample code for blog post: http://kurotofu.sytes.net/kanji/fool/?p=934
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `users` ( | |
user_id int(10) NOT NULL AUTO_INCREMENT, | |
user_name varchar(40) NOT NULL, | |
password text NOT NULL, | |
enabled tinyint( 1 ) NOT NULL DEFAULT '1', | |
PRIMARY KEY (user_id) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO `users` ( | |
`user_name`, | |
`password` | |
) | |
VALUES ( | |
'hogehoge', | |
'b862526843a6cf5b92c29e2fbdd209f52dfd4ee7caaf567d38363f72b0a02ff798154edd384aadee' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- <user-service> | |
- <user name="hoge" password="4c17b8a334f61a4d5c0b79f11977482ea7542c0761b74ee421b9cfe620ec1a7e07357932200428f6" authorities="ROLE_USER" /> | |
- </user-service> | |
+ <jdbc-user-service data-source-ref="dataSource" | |
+ users-by-username-query="SELECT user_name, password, enabled FROM users WHERE user_name = ?" | |
+ authorities-by-username-query="SELECT user_name, 'ROLE_USER' FROM users WHERE user_name = ?" | |
+ /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> | |
<beans:property name="driverClassName" value="com.mysql.jdbc.Driver" /> | |
<beans:property name="url" value="jdbc:mysql://localhost/sample" /> | |
<beans:property name="username" value="openpolitics.jp" /> | |
<beans:property name="password" value="VpELXFU2sVpKaYxM" /> | |
</beans:bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment