kong-java-client

Kong is a popular Open Source API Gateway. Kong Java Client makes it easy to configure the API Gateway through your code.

Лицензия

Лицензия

Категории

Категории

Java Языки программирования CLI Взаимодействие с пользователем
Группа

Группа

com.github.vaibhav-sinha
Идентификатор

Идентификатор

kong-java-client
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

kong-java-client
Kong is a popular Open Source API Gateway. Kong Java Client makes it easy to configure the API Gateway through your code.
Ссылка на сайт

Ссылка на сайт

https://github.com/vaibhav-sinha/kong-java-client
Система контроля версий

Система контроля версий

http://github.com/vaibhav-sinha/kong-java-client/tree/master

Скачать kong-java-client

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.vaibhav-sinha/kong-java-client/ -->
<dependency>
    <groupId>com.github.vaibhav-sinha</groupId>
    <artifactId>kong-java-client</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.vaibhav-sinha/kong-java-client/
implementation 'com.github.vaibhav-sinha:kong-java-client:0.2.0'
// https://jarcasting.com/artifacts/com.github.vaibhav-sinha/kong-java-client/
implementation ("com.github.vaibhav-sinha:kong-java-client:0.2.0")
'com.github.vaibhav-sinha:kong-java-client:jar:0.2.0'
<dependency org="com.github.vaibhav-sinha" name="kong-java-client" rev="0.2.0">
  <artifact name="kong-java-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.vaibhav-sinha', module='kong-java-client', version='0.2.0')
)
libraryDependencies += "com.github.vaibhav-sinha" % "kong-java-client" % "0.2.0"
[com.github.vaibhav-sinha/kong-java-client "0.2.0"]

Зависимости

compile (7)

Идентификатор библиотеки Тип Версия
com.squareup.retrofit2 : retrofit jar 2.3.0
com.squareup.retrofit2 : converter-gson jar 2.3.0
com.google.code.gson : gson jar 2.8.1
org.slf4j : slf4j-api jar 1.6.2
org.slf4j : slf4j-log4j12 jar 1.6.2
commons-logging : commons-logging-api jar 1.1
log4j : log4j jar 1.2.16

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.16.16

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Kong Java Client

Kong is a popular Open Source API Gateway. Kong Java Client makes it easy to configure the API Gateway through your code.

Installation

The artifact is available on Maven Central Repository and be downloaded by adding the following dependency in pom.xml

<dependency>
    <groupId>com.github.vaibhav-sinha</groupId>
    <artifactId>kong-java-client</artifactId>
    <version>0.2.0</version>
</dependency>

Usage

KongClient kongClient = new KongClient("http://localhost:8001");
Consumer request = new Consumer();
request.setCustomId("1234-5678-9012");
Consumer response = kongClient.getConsumerService().createConsumer(request);

Look in the tests to find more examples.

Supported Plugins

Besides the Admin APIs, Plugin configuration is also supported.

Authentication Plugins

  • Basic Auth
  • Key Auth
  • HMAC Auth
  • JWT Auth
  • OAuth2
  • LDAP

Security Plugins

  • ACL
  • IP Restriction

Traffic Control Plugins

  • Rate Limiting
  • Request Size Limiting
  • Request Termination

Only those plugins are supported which might need configuration through code. For example, adding rate limit for a new consumer when there is a new signup. Plugins which require one time configuration are not supported.

Example Usage

To add credentials for a new Consumer for Basic Auth

kongClient.getBasicAuthService().addCredentials("con-su-mer-id", "username", "password");

To add OAuth2 Plugin for an API

//See: RetrofitApiPluginServiceTest.java
kongClient.getApiPluginService().addPluginForApi(API_NAME, oauth2Plugin);

To add an Application for a Consumer for OAuth2

//See: RetrofitOAuth2ManageServiceTest.java
kongClient.getOAuth2ManageService().createConsumerApplication(CONSUMER_ID, 
    new Application(appName, appRedirectUrl, appClientId, appClientSecret));

To do the OAuth2 Process (Authorization Code)

//See: RetrofitOAuth2ProcessServiceTest.java
kongClient.getOAuth2ProcessService().authorize(API_URI, authorizationRequest);
kongClient.getOAuth2ProcessService().grantToken(API_URI, grantTokenRequest)

Версии библиотеки

Версия
0.2.0
0.1.0