回顾:
前面做的品牌的增删改查 分页,规格的增删改查,规格项的增删改查
品牌的增删改查:
用到了 angutl js 插件,来进行增删改查
$scope 特有的域
ng-module 标签注入模块
ng-controller 标签 事务控制
ng-app 标签创建模块
angulr js 可以模拟后台做 代码分离
KaTeX parse error: Expected '}', got 'EOF' at end of input: …seController',{scope:$scope}) 伪继承
今日介绍:
spring security 安全框架介绍 拦截
:用户名验证/用户权限管理
:页面权限管理
安全框架 默认是提交地址是
id=loginFrom action=/login method=方式post
前端登录页码:
<form class="sui-form" id="loginForm" action="/login" method="post">
<div class="input-prepend"><span class="add-on loginname"></span>
<input id="prependedInput" name="username" type="text" placeholder="邮箱/用户名/手机号" class="span2 input-xfat">
</div>
<div class="input-prepend"><span class="add-on loginpwd"></span>
<input id="prependedInput" name="password" type="password" placeholder="请输入密码" class="span2 input-xfat">
</div>
<div class="setting">
<label class="checkbox inline"><input name="m1" type="checkbox" value="2" checked="">自动登录</label>
<span class="forget">忘记密码?</span>
</div>
<div class="logined">
<a class="sui-btn btn-block btn-xlarge btn-danger" onclick="document.getElementById('loginForm').submit()" target="_blank">登 录</a>
</div>
</form>
默认拦截 /**拦截所有目录 权限:ROLE_USER 必须大写
<intercept-url pattern="/**" access="ROLE_SELLER"/>
service 业务来处理用户名验证
userDatis…实现这个接口
创建一个权限集合
获取用户名 判断用户名是否为空 不为空的话 retrun 用户名 用户名密码 权限否则 null
private SellerService sellerService;
public void setSellerService(SellerService sellerService) {
this.sellerService = sellerService;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
List<GrantedAuthority> grantedAuths = new ArrayList<GrantedAuthority>();
grantedAuths.add(new SimpleGrantedAuthority("ROLE_SELLER"));
//获得商家对象
Seller one =
sellerService.findOne(username);
//判断用户是否为空
if (one!=null) {
//看用户状态
if (one.getStatus().equals("1")) {
return new User(username, one.getPassword(), grantedAuths);
}
}
return null;
}
用户名密码实在controller层
//密码加密
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
String password = passwordEncoder.encode(seller.getPassword());
seller.setPassword(password);