use of org.apache.oltu.oauth2.rs.request.OAuthAccessResourceRequest in project tesla by linking12.
the class Oauth2HttpRequestFilter method doFilter.
@Override
public HttpResponse doFilter(HttpRequest originalRequest, HttpObject httpObject, ChannelHandlerContext channelHandlerContext) {
if (httpObject instanceof HttpRequest) {
try {
HttpRequest httpRequest = (HttpRequest) httpObject;
NettyHttpServletRequest servletRequest = new NettyHttpServletRequest(httpRequest, "/", channelHandlerContext);
OAuthAccessResourceRequest oauthRequest = new OAuthAccessResourceRequest(servletRequest, ParameterStyle.QUERY);
String accessToken = oauthRequest.getAccessToken();
if (!oauth2TokenCache.checkAccessToken(accessToken)) {
return super.createResponse(HttpResponseStatus.FORBIDDEN, originalRequest);
}
} catch (Throwable e) {
return super.createResponse(HttpResponseStatus.FORBIDDEN, originalRequest);
}
}
return null;
}
Aggregations