package com.mwc.test.DrawDemo.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.stereotype.Component;
@Component
public class UserSercurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().
antMatchers("/login", "/actuator/**", "/swagger-ui.html/**", "/h2-console/**","/js/**").permitAll();
http.authorizeRequests().anyRequest().authenticated();//设置无需登录即可访问的页面,其他都不可以访问
http.formLogin().loginPage("/login").failureUrl("/login?error").defaultSuccessUrl("/index").permitAll() //设置登录页面
.and().logout().logoutSuccessUrl("/login").permitAll();
http.csrf().disable().headers().frameOptions().disable()
.and().httpBasic().disable();
http.rememberMe();
}
@Autowired
UserDetailService userDetailsService;
@Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(md5PasswordEncoder());
auth.eraseCredentials(false);
}
public static final String PASSWORD_ENCODER_SALT = "demo-secret-key";
@Bean
public Md5PasswordEncoder md5PasswordEncoder() {
return new Md5PasswordEncoder() {
@Override
public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
return super.isPasswordValid(encPass, rawPass, PASSWORD_ENCODER_SALT);
}
};
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Spring boot实现用户登录,转盘,并将获得的奖励记录数据库的功能
共75个文件
png:14个
class:10个
java:9个
需积分: 50 29 下载量 11 浏览量
2018-01-23
10:27:06
上传
评论 1
收藏 263KB ZIP 举报
温馨提示
Spring boot实现用户登录,转盘,并将获得的奖励记录数据库的功能,可以实现用户登录,并且查看自己获得的奖励,和其他所有人获得的奖励等功能
资源推荐
资源详情
资源评论
收起资源包目录
DrawDemo.zip (75个子文件)
DrawDemo
pom.xml 3KB
target
test-classes
com
mwc
test
DrawDemo
DrawDemoApplicationTests.class 644B
classes
META-INF
maven
com.mwc.test
DrawDemo
pom.xml 3KB
pom.properties 219B
MANIFEST.MF 340B
application.properties 695B
templates
login.html 499B
index.html 7KB
layer.html 427B
com
mwc
test
DrawDemo
config
UserSercurityConfig.class 6KB
UserDetailService.class 2KB
UserSercurityConfig$1.class 1KB
repository
UserRepository.class 435B
DrawDemoApplication.class 726B
controller
UserController.class 3KB
service
UserService.class 374B
impl
UserServiceImpl.class 2KB
entity
User.class 4KB
static
css
style.css 338B
images
turnplate-bg.png 5KB
1.png 498B
turnplate-pointer.png 3KB
2.png 754B
js
jquery.min.js 85KB
skin
moon
default.png 7KB
style.css 3KB
default
loading-2.gif 2KB
icon.png 11KB
loading-1.gif 701B
layer.css 14KB
icon-ext.png 6KB
loading-0.gif 6KB
layer.js 21KB
awardRotate.js 11KB
Test.js 641B
mvnw 6KB
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.core.resources.prefs 155B
org.eclipse.jdt.core.prefs 243B
src
test
java
com
mwc
test
DrawDemo
DrawDemoApplicationTests.java 340B
main
resources
application.properties 695B
templates
login.html 499B
index.html 7KB
layer.html 427B
static
css
style.css 338B
images
turnplate-bg.png 5KB
1.png 498B
turnplate-pointer.png 3KB
2.png 754B
js
jquery.min.js 85KB
skin
moon
default.png 7KB
style.css 3KB
default
loading-2.gif 2KB
icon.png 11KB
loading-1.gif 701B
layer.css 14KB
icon-ext.png 6KB
loading-0.gif 6KB
layer.js 21KB
awardRotate.js 11KB
Test.js 641B
java
com
mwc
test
DrawDemo
config
UserDetailService.java 1KB
UserSercurityConfig.java 2KB
DrawDemoApplication.java 317B
repository
UserRepository.java 277B
controller
UserController.java 2KB
service
UserService.java 249B
impl
UserServiceImpl.java 917B
entity
User.java 554B
.project 768B
.classpath 1KB
.gitignore 249B
.mvn
wrapper
maven-wrapper.jar 46KB
maven-wrapper.properties 110B
mvnw.cmd 5KB
共 75 条
- 1
资源评论
m64729599
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功