0
轉發我已經配置了我所有的春季安全和OAuth令牌獲取等春天的OAuth攔截REST API的調用,並從一個攔截器
但我必須驗證從DB用戶在每個REST API調用?
這是我的例子API:
@GET
@Path("/getUUID")
public Response getUUID(@Context HttpServletRequest request, final @Context SecurityContext securityContext) {
//here do i have to do this in each api or there is one filter that can i write and pass this user object from that to api
User loadUser = loadUserFromSecurityContext(securityContext);
}
protected User loadUserFromSecurityContext(SecurityContext securityContext) {
OAuth2Authentication requestingUser = (OAuth2Authentication) (securityContext).getUserPrincipal();
String principal = requestingUser.getUserAuthentication().getName();
User user = null;
user = new UserDAO().getUser(principal);
return user;
}
我有這些確切的設置,但攔截器沒有收到請求。任何想法 ? –