/**
* @param request
* @return A valid token for the given input.
*/
private SecurityToken extractAndValidateToken(HttpServletRequest request) throws GadgetException {
SecurityToken token = new AuthInfo(request).getSecurityToken();
if (token == null) {
// TODO: Determine appropriate external error code for this.
throw new GadgetException(GadgetException.Code.INVALID_SECURITY_TOKEN);
}
return token;