Git Product home page Git Product logo

ibanity-java's Introduction

Java wrapper for the Ibanity API

Maven Central Build Status License Maintainability Security Reliability

This Java Client library offers various Services you can use in order to submit requests towards the Ibanity Platform.

Quick start

Configure the library using IbanityServiceBuilder.builder().

Minimal configuration values are:

  • The ibanity url
  • Your application private key
  • the passphrase for the private key
  • the application public certificate
    IbanityService ibanityServiceBuilder = IbanityServiceBuilder.builder()
            .ibanityApiEndpoint("https://api.ibanity.com")
            .tlsPrivateKey(myPrivateKey)
            .passphrase("aPassphrase")
            .tlsCertificate(myCertificate)
            .build();

You can then make use of Xs2a services through your IbanityService instance.

CustomerAccessTokenService customerAccessTokensService = ibanityService.xs2aService().customerAccessTokensService();

All services are thread safe and can be configured as singleton if you want to leverage frameworks like Spring.

See ClientSample class for extended examples.

Perform custom request to Ibanity

You can perform custom http calls to Ibanity using the IbanityHttpClient. It can be accessed by calling :

IbanityHttpClient ibanityHttpClient = ibanityService.ibanityHttpClient();

Configure proxy

If you are using a Web application firewall or a proxy, you can configure it in the IbanityServiceBuilder.

public interface OptionalPropertiesBuilder {

...

    OptionalPropertiesBuilder proxyEndpoint(String proxyEndpoint);

}
    IbanityService ibanityServiceBuilder = IbanityServiceBuilder.builder()
            .ibanityApiEndpoint("https://api.ibanity.com")
            .tlsPrivateKey(myPrivateKey)
            .passphrase("aPassphrase")
            .tlsCertificate(myCertificate)
            .proxyEndpoint("https://interal.proxy.com")
            .build();

Use HttpSignatureService

If you want to sign http request, you can use the HttpSignatureService from the library.

Instantiate the implementation class by calling:

IbanityHttpSignatureService = new IbanityHttpSignatureServiceImpl(
                                              privateKey,
                                              certificate,
                                              certificateId);
    public interface IbanityHttpSignatureService {
    
        /**
         * Alias to be used when the request has no payload.
         * @see IbanityHttpSignatureService#getHttpSignatureHeaders(String, URL, Map, String)
         * Allows you to create the needed headers to sign an http request following draft http signature
         * @see <a href="https://tools.ietf.org/html/draft-cavage-http-signatures-09">https://tools.ietf.org/html/draft-cavage-http-signatures-09</a>
         * @param httpMethod the http method of the current request.
         * @param url the url containing host, path and query parameters.
         * @param requestHeaders the headers of the current request. All ibanity-* headers will included in the signature.
         * @return the map with signature related headers: date, digest and signature headers.
         */
        Map<String, String> getHttpSignatureHeaders(String httpMethod, URL url, Map<String, String> requestHeaders);
    
        /**
         * Allows you to create the needed headers to sign an http request following draft http signature
         * @see <a href="https://tools.ietf.org/html/draft-cavage-http-signatures-09">https://tools.ietf.org/html/draft-cavage-http-signatures-09</a>
         * @param httpMethod the http method of the current request.
         * @param url the url containing host, path and query parameters.
         * @param requestHeaders the headers of the current request. All ibanity-* headers will included in the signature.
         * @param payload the payload of the actual request.
         * @return the map with signature related headers: date, digest and signature headers.
         */
        Map<String, String> getHttpSignatureHeaders(String httpMethod, URL url, Map<String, String> requestHeaders, String payload);
    
    }

Add custom Http Interceptors

The library uses Apache HttpClient.

You can add your own HttpRequestInterceptor and HttpResponseInterceptor.

Configuring custom interceptors can be done through the IbanityServiceBuilder. They are optional.

public interface OptionalPropertiesBuilder {

...

    OptionalPropertiesBuilder withHttpRequestInterceptors(HttpRequestInterceptor... httpRequestInterceptor);

    OptionalPropertiesBuilder withHttpResponseInterceptors(HttpResponseInterceptor... httpResponseInterceptor);
}
        OptionalPropertiesBuilder ibanityServiceBuilder = IbanityServiceBuilder.builder()
                .ibanityApiEndpoint("https://api.ibanity.com")
                .tlsPrivateKey(privateKey)
                .passphrase(passphrase)
                .tlsCertificate(certificate)
                .withHttpRequestInterceptors((request, context) -> LOGGER.info("This is a HttpRequestInterceptor"))
                .withHttpResponseInterceptors((response, context) -> LOGGER.info("This is a HttpResponseInterceptor"));

Requirements

  • Java 8 (or above)
  • Maven (for compilation)

JCE Unlimited Strength Jurisdiction Policy Files

https://golb.hplar.ch/2017/10/JCE-policy-changes-in-Java-SE-8u151-and-8u152.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.