Skip to content

Commit

Permalink
Merge pull request #1065 from watson-developer-cloud/release-7.1.0
Browse files Browse the repository at this point in the history
Release 7.1.0
  • Loading branch information
lpatino10 authored Jun 7, 2019
2 parents 9919968 + 6737d8f commit 95ccf41
Show file tree
Hide file tree
Showing 251 changed files with 7,934 additions and 3,411 deletions.
55 changes: 32 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Java client library to use the [Watson APIs][wdc].
* [Authentication](#authentication)
* [IAM](#iam)
* [Username and password](#username-and-password)
* [API key](#api-key)
* [ICP](#icp)
* [Using the SDK](#using-the-sdk)
* [Parsing responses](#parsing-responses)
* [Configuring the HTTP client](#configuring-the-http-client)
Expand Down Expand Up @@ -184,6 +184,7 @@ Watson services are migrating to token-based Identity and Access Management (IAM

- With some service instances, you authenticate to the API by using **[IAM](#iam)**.
- In other instances, you authenticate by providing the **[username and password](#username-and-password)** for the service instance.
- If you're using a Watson service on ICP, you'll need to authenticate in a [specific way](#icp).

### Getting credentials

Expand Down Expand Up @@ -245,55 +246,63 @@ You supply either an IAM service **API key** or an **access token**:
Supplying the IAM API key:

```java
// in the constructor, letting the SDK manage the IAM token
// letting the SDK manage the IAM token
IamOptions options = new IamOptions.Builder()
.apiKey("<iam_api_key>")
.url("<iam_url>") // optional - the default value is https://iam.cloud.ibm.com/identity/token
.build();
Discovery service = new Discovery("2017-11-07", options);
```

```java
// after instantiation, letting the SDK manage the IAM token
Discovery service = new Discovery("2017-11-07");
IamOptions options = new IamOptions.Builder()
.apiKey("<iam_api_key>")
.build();
service.setIamCredentials(options);
```

Supplying the access token:

```java
// in the constructor, assuming control of managing IAM token
// assuming control of managing IAM token
IamOptions options = new IamOptions.Builder()
.accessToken("<access_token>")
.build();
Discovery service = new Discovery("2017-11-07", options);
```

#### Username and password

```java
// after instantiation, assuming control of managing IAM token
Discovery service = new Discovery("2017-11-07");
IamOptions options = new IamOptions.Builder()
.accessToken("<access_token>")
// in the constructor
BasicAuthConfig config = new BasicAuthConfig.Builder()
.username("<username>")
.password("<password")
.build();
service.setIamCredentials(options);
Discovery service = new Discovery("2017-11-07", config);
```

#### Username and password
#### ICP
Like IAM, you can pass in credentials to let the SDK manage an access token for you or directly supply an access token to do it yourself.

```java
// in the constructor
Discovery service = new Discovery("2017-11-07", "<username>", "<password>");
// letting the SDK manage the token
ICP4DConfig config = new ICP4DConfig.Builder()
.url("<ICP token exchange base URL>")
.username("<username>")
.password("<password>")
.disableSSLVerification(true)
.build();
Discovery service = new Discovery("2017-11-07", config);
service.setEndPoint("<service ICP URL>");
```

```java
// after instantiation
Discovery service = new Discovery("2017-11-07");
service.setUsernameAndPassword("<username>", "<password>");
// assuming control of managing the access token
ICP4DConfig config = new ICP4DConfig.Builder()
.url("<ICP token exchange base URL>")
.userManagedAccessToken("<access token>")
.disableSSLVerification(true)
.build();
Discovery service = new Discovery("2017-11-07", config);
service.setEndPoint("<service ICP URL>");
```

Be sure to both disable SSL verification when authenticating and set the endpoint explicitly to the URL given in ICP.

## Using the SDK

### Parsing responses
Expand Down
5 changes: 3 additions & 2 deletions assistant/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ task sourcesJar(type: Jar) {
}

repositories {
maven { url = "http://repo.maven.apache.org/maven2" }
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo" }
}

artifacts {
Expand Down Expand Up @@ -59,7 +60,7 @@ checkstyle {
dependencies {
compile project(':common')
testCompile project(':common').sourceSets.test.output
compile 'com.ibm.cloud:sdk-core:3.0.2'
compile 'com.ibm.cloud:sdk-core:4.4.0'
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
}

Expand Down
Loading

0 comments on commit 95ccf41

Please sign in to comment.