Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 747 Bytes

jwt.md

File metadata and controls

20 lines (14 loc) · 747 Bytes

基于JWT的认证授权

配合 @PreAuthorize("hasAuthority('student')") 可对特定接口设置访问权限

具体实现详见:

@Override
public Collection<?extends GrantedAuthority> getAuthorities(){
        if(userInfo.getPermission()==(byte)0)return Arrays.asList(new SimpleGrantedAuthority("student"));
        else if(userInfo.getPermission()==(byte)1)return Arrays.asList(new SimpleGrantedAuthority("teacher"));
        return Arrays.asList(new SimpleGrantedAuthority("parents"));
        }

刷新JWT