Skip to content

Instantly share code, notes, and snippets.

@yanhua365
Last active August 29, 2015 14:05
Show Gist options
  • Save yanhua365/6708882c8f8ae91a3ec6 to your computer and use it in GitHub Desktop.
Save yanhua365/6708882c8f8ae91a3ec6 to your computer and use it in GitHub Desktop.
Spring Security的各种User Service
<authentication-manager>
<authentication-provider>
<user-service>
<user name="sa" password="sa" authorities="ROLE_USER,ROLE_ADMIN,ROLE_UC_ADMIN" />
</user-service>
</authentication-provider>
</authentication-manager>
<authentication-manager alias="authenticationManager">
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="
select username, `password`, 'true'
from sys_user
where username=?;"
authorities-by-username-query="
select u.username , r.enName from sys_user_role ur
left join sys_user u on ur.user_id=u.id
left join sys_role r on ur.role_id =r.id where u.username=?"
/>
</authentication-provider>
</authentication-manager>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment