我希望使用jwt安全性对用户进行身份验证以使用端点:
@PostMapping("/{class_id}/find")
public Page<ClassItemsFullDTO> search(Authentication authentication, Principal principal, @PathVariable("class_id") Integer classId, @Valid ClassItemsSearchParams params, Pageable pageable) {
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!! authentication.getName() " + authentication.getName());
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!! principal.getName() " + principal.getName());
Page<ClassItemsFullDTO> list = classItemsRestService.findClassItemsByClassId(classId, params, pageable);
return list;
}
看起来这段代码是用来获取用户的。如果使用了会话类型,我就得到npe。你知道对于jwt,我怎样才能帮助用户吗?
github完整源代码:https://github.com/rcbandit111/oauth2/blob/master/src/main/java/org/engine/rest/datapagescontroller.java
暂无答案!
目前还没有任何答案,快来回答吧!