-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LTI Redirection #2
Conversation
|
||
logger.trace(new String(b)); | ||
|
||
if (303 == status) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number. This possibly should be opened up as well to the 300-series, but right now I know that the service returns a 303 on success.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like progress. Progress is progress. 👍 .
|
||
/** | ||
* | ||
* @author sibley |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't favor @author
annotations in shared-ownership codebases, but I recognize it's a matter of style and reasonable developers can differ on this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care for it either. I've since edited the new file templates to omit this and license information.
@RequestMapping(value="/go/{key}", method=RequestMethod.GET) | ||
public void proxyRedirect(HttpServletRequest request, HttpServletResponse response, @PathVariable String key) throws | ||
ClientProtocolException, IOException, LtiSigningException, URISyntaxException { | ||
int statusCode = HttpServletResponse.SC_BAD_REQUEST; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest inline HttpServletResponse.SC_BAD_REQUEST
the one place it's used in this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if (null != uri) { | ||
response.sendRedirect(uri.toString()); | ||
} else { | ||
response.sendError(statusCode, "Could not build redirect URI!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest including {key}
in error response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is broken, I'm just opening a pull request to start a code reviewI refactored a bit of the existing code and started writing a redirector.
The refactors were pulling HttpServletRequest from the Service scope, and pulling some common prep logic out to be used by the redirector. These should make unit testing the Service methods easier (though I haven't written any yet 🤷♂️)
The redirector is using the Spring Web's built in RestTemplate to hit the remote url. I opted to go with that over HttpComponents just to learn something new and to not pull in a dependency if I didn't need to. However, as it's written now, I'm getting a 501 back from the external service, so I may pull in HttpComponents just for the extra debugging information I know I can get out of it.I looked at the rssToJson microservice and swapped in HttpComponents per that. Everything's a whole lot simpler. Locally I'm getting a 400 from the external service, but that's probably because I don't have true authentication set up. The real test of this will be out on predev.