自定义可以认证的用户信息:
//做定义主体的认证
//默认启动报错:Cannot pass a null GrantedAuthority collection
//以上报错解决:必须每一个用户都有自己默认的权限信息
//权限使用roles(角色)或者authorities(权限)【权限】,
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// TODO Auto-generated method stub
//super.configure(auth);
auth.inMemoryAuthentication().withUser("lbs").password("libinshen").roles("admin","学徒","宗师")
.and()
.withUser("wbc").password("666").authorities("admin");
}
网友评论