Package com.google.nigori.common

Examples of com.google.nigori.common.UnauthorisedException


    }
  }

  private static void failure(Response response) throws IOException, UnauthorisedException {
    if (response.resp.getResponseCode() == Http.UNAUTHORIZED) {
      throw new UnauthorisedException(response.jsonResponse);
    }
    throw new IOException("Server did not accept request(" + response.resp.getResponseCode()
        + "). " + response.jsonResponse);
  }
View Full Code Here


        JsonConversionException, IOException, UnauthorisedException {
      String json = getJsonAsString(req, maxJsonQueryLength);
      AuthenticateRequest auth = MessageLibrary.authenticateRequestFromJson(json);
      boolean success = protocol.authenticate(auth);
      if (!success) {
        throw new UnauthorisedException("Authorisation failed");
      }

      emptyBody(resp);
    }
View Full Code Here

            try {
              return database.getUser(publicHash);
            } catch (UserNotFoundException e) {
              // TODO(drt24): potential security vulnerability - user existence oracle.
              // Should not happen often - is only possible due to concurrency
              throw new UnauthorisedException("No such user");
            }
          } else {
            throw new UnauthorisedException("Invalid nonce or no such user");
          }
        } else {
          throw new UnauthorisedException("The signature is invalid");
        }
      } catch (NoSuchAlgorithmException nsae) {
        severe("authenticateUser",nsae);
        throw new CryptoException("Internal error attempting to verify signature");
      }
    } catch (UserNotFoundException e1) {
      warning("authenticateUser",e1);
      throw new UnauthorisedException("No such user");
    }
  }
View Full Code Here

TOP

Related Classes of com.google.nigori.common.UnauthorisedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.