Package com.google.nigori.common.NigoriMessages

Examples of com.google.nigori.common.NigoriMessages.AuthenticateRequest


      DSASignature signedNonce =
          signer.sign(Util.joinBytes(MessageLibrary.toBytes(serverName), nonce.nt(), nonce.nr(),
              toBytes(command), Util.joinBytes(payload)));
      byte[] sig = Util.joinBytes(signedNonce.getR(), signedNonce.getS());

      AuthenticateRequest req =
          AuthenticateRequest.newBuilder()
              .setPublicKey(ByteString.copyFrom(signer.getPublicHash())).setSig(
                  ByteString.copyFrom(sig)).setNonce(ByteString.copyFrom(nonce.toToken()))
              .setServerName(serverName).build();
View Full Code Here


    @Override
    public void handle(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
        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");
      }
View Full Code Here

    }
  }

  @Override
  public boolean unregister(UnregisterRequest request) throws IOException, UnauthorisedException {
    AuthenticateRequest auth = request.getAuth();
    User user = authenticateUser(auth,MessageLibrary.REQUEST_UNREGISTER);

    return database.deleteUser(user);
  }
View Full Code Here

  @Override
  public GetResponse get(GetRequest request) throws IOException, NotFoundException,
      UnauthorisedException {
    byte[] index = request.getKey().toByteArray();
    AuthenticateRequest auth = request.getAuth();
    User user;
    byte[] revision = null;
    if (request.hasRevision()) {
      revision = request.getRevision().toByteArray();
      user = authenticateUser(auth, MessageLibrary.REQUEST_GET, index, revision);
View Full Code Here

  }

  @Override
  public GetIndicesResponse getIndices(GetIndicesRequest request) throws IOException,
      NotFoundException, UnauthorisedException {
    AuthenticateRequest auth = request.getAuth();
    User user = authenticateUser(auth,MessageLibrary.REQUEST_GET_INDICES);

    Collection<byte[]> value = database.getIndices(user);

    if (value == null) {
View Full Code Here

  @Override
  public GetRevisionsResponse getRevisions(GetRevisionsRequest request) throws IOException,
      NotFoundException, UnauthorisedException {
    byte[] index = request.getKey().toByteArray();
    AuthenticateRequest auth = request.getAuth();
    User user = authenticateUser(auth,MessageLibrary.REQUEST_GET_REVISIONS,index);

    Collection<byte[]> value = database.getRevisions(user, index);

    if (value == null) {
View Full Code Here

    return MessageLibrary.getRevisionsResponseAsProtobuf(value);
  }

  @Override
  public boolean put(PutRequest request) throws IOException, UnauthorisedException {
    AuthenticateRequest auth = request.getAuth();

    byte[] index = request.getKey().toByteArray();
    byte[] revision = request.getRevision().toByteArray();
    byte[] value = request.getValue().toByteArray();
    User user = authenticateUser(auth, MessageLibrary.REQUEST_PUT, index, revision, value);
View Full Code Here

  }

  @Override
  public boolean delete(DeleteRequest request) throws IOException, NotFoundException,
      UnauthorisedException {
    AuthenticateRequest auth = request.getAuth();

    byte[] index = request.getKey().toByteArray();
    User user = authenticateUser(auth,MessageLibrary.REQUEST_DELETE,index);

    boolean exists = database.getRecord(user, index) != null;
View Full Code Here

TOP

Related Classes of com.google.nigori.common.NigoriMessages.AuthenticateRequest

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.