Class AuthenticationService

java.lang.Object
com.github.badpop.jcoinbase.service.auth.AuthenticationService

public class AuthenticationService
extends java.lang.Object
Manage all the security mechanism required by Coinbase to call protected resources
  • Constructor Summary

    Constructors
    Constructor Description
    AuthenticationService()  
  • Method Summary

    Modifier and Type Method Description
    io.vavr.control.Either<InvalidApiKeyAndSecretException,​java.lang.Void> allow​(JCoinbaseClient client)
    Really important method that check if the given client is properly build to access coinbase protected resources.
    java.lang.String[] getAuthenticationHeaders​(JCoinbaseProperties properties, java.lang.String httpMethod, java.lang.String httpPath, java.lang.String httpBody)
    Get the headers required by the coinbase api to access protected resources like users or transactions
    java.lang.String[] getAuthenticationHeaders​(io.vavr.control.Option<java.lang.String> apiKey, io.vavr.control.Option<java.lang.String> secret, io.vavr.control.Option<java.lang.String> apiVersion, long timestamp, java.lang.String httpMethod, java.lang.String httpPath, java.lang.String httpBody)
    Get the headers required by the coinbase api to access protected resources like users or transactions

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AuthenticationService

      public AuthenticationService()
  • Method Details

    • getAuthenticationHeaders

      public java.lang.String[] getAuthenticationHeaders​(JCoinbaseProperties properties, java.lang.String httpMethod, java.lang.String httpPath, java.lang.String httpBody)
      Get the headers required by the coinbase api to access protected resources like users or transactions
      Parameters:
      properties - the JCoinbase properties presents int the JCoinbaseClient
      httpMethod - the http verb used to call the resource
      httpPath - the http path of the coinbase api resource
      httpBody - the http body used to call the resource
      Returns:
      a String[] containing all the headers required by the coinbase api
    • getAuthenticationHeaders

      public java.lang.String[] getAuthenticationHeaders​(io.vavr.control.Option<java.lang.String> apiKey, io.vavr.control.Option<java.lang.String> secret, io.vavr.control.Option<java.lang.String> apiVersion, long timestamp, java.lang.String httpMethod, java.lang.String httpPath, java.lang.String httpBody)
      Get the headers required by the coinbase api to access protected resources like users or transactions
      Parameters:
      apiKey - a coinbase api key
      secret - a coinbase api secret
      apiVersion - a coinbase api version
      timestamp - the current system timestamp or, the coinbase api timestamp fetched using DataService #getTime() method
      httpMethod - the http verb used to call the resource
      httpPath - the http path of the coinbase api resource
      httpBody - the http body used to call the resource
      Returns:
      a String[] containing all the headers required by the coinbase api
    • allow

      public io.vavr.control.Either<InvalidApiKeyAndSecretException,​java.lang.Void> allow​(JCoinbaseClient client)
      Really important method that check if the given client is properly build to access coinbase protected resources.
      Parameters:
      client - The client we want to know if it can access the protected resources of the coinbase api
      Returns:
      an Either containing a Left projection if not allowed, a Right projection otherwise