protected void doGet(final HttpServletRequest request, final HttpServletResponse resp)
throws IOException {
OAuth2Accessor accessor = null;
try {
final OAuth2Message msg = this.oauth2MessageProvider.get();
msg.parseRequest(request);
final OAuth2Error error = msg.getError();
final String requestStateKey = msg.getState();
if (requestStateKey == null) {
if (error != null) {
OAuth2CallbackServlet.sendError(error, msg.getErrorDescription(), msg.getErrorUri(),
null, resp, null);
} else {
OAuth2CallbackServlet.sendError(OAuth2Error.CALLBACK_PROBLEM,
"OAuth2CallbackServlet requestStateKey is null.", "", null, resp, null);
}
return;
}
final Integer index = Integer.decode(requestStateKey);
accessor = this.store.getOAuth2Accessor(index);
if (error != null) {
OAuth2CallbackServlet.sendError(error, msg.getErrorDescription(), msg.getErrorUri(),
accessor, resp, null);
return;
}
if ((accessor == null) || (!accessor.isValid()) || (accessor.isErrorResponse())) {