Skip to content

Commit a99072f

Browse files
author
Nakshatra Sharma
authored
Merge pull request #197 from oracle/release_2020-02-25
Releasing version 1.13.1
2 parents 4f13012 + 2e676ba commit a99072f

File tree

126 files changed

+7308
-210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+7308
-210
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/).
55

6+
## 1.13.1 - 2020-02-25
7+
### Added
8+
- Support for restarting autonomous databases in the Database service
9+
- Support for private endpoints on autonomous databases in the Database service
10+
- Support for IP-based policies in the Identity service
11+
- Support for management of OAuth 2.0 client credentials in the Identity service
12+
- Support for OCI Functions as a subscription protocol in the Notifications service
13+
614
## 1.13.0 - 2020-02-18
715
### Added
816
- Support for the NoSQL Database service

bmc-addons/bmc-apache-connector-provider/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk-addons</artifactId>
8-
<version>1.13.0</version>
8+
<version>1.13.1</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>com.oracle.oci.sdk</groupId>
4545
<artifactId>oci-java-sdk-common</artifactId>
46-
<version>1.13.0</version>
46+
<version>1.13.1</version>
4747
</dependency>
4848

4949
<!-- Explicitly pull in this version of httpclient and its httpcore dependency to address:

bmc-addons/bmc-resteasy-client-configurator/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk-addons</artifactId>
8-
<version>1.13.0</version>
8+
<version>1.13.1</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

@@ -36,7 +36,7 @@
3636
<dependency>
3737
<groupId>com.oracle.oci.sdk</groupId>
3838
<artifactId>oci-java-sdk-common</artifactId>
39-
<version>1.13.0</version>
39+
<version>1.13.1</version>
4040
</dependency>
4141
</dependencies>
4242
</project>

bmc-addons/bmc-sasl/pom.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>oci-java-sdk-addons</artifactId>
7+
<groupId>com.oracle.oci.sdk</groupId>
8+
<version>1.13.1</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>oci-java-sdk-addons-sasl</artifactId>
13+
14+
<build>
15+
<plugins>
16+
<plugin>
17+
<groupId>com.github.os72</groupId>
18+
<artifactId>protoc-jar-maven-plugin</artifactId>
19+
<version>3.11.1</version>
20+
<executions>
21+
<execution>
22+
<phase>generate-sources</phase>
23+
<goals>
24+
<goal>run</goal>
25+
</goals>
26+
<configuration>
27+
<inputDirectories>
28+
<include>${project.basedir}/src/main/protobuf</include>
29+
</inputDirectories>
30+
<outputTargets>
31+
<outputTarget>
32+
<type>java</type>
33+
<outputDirectory>${project.basedir}/target/generated-sources/protobuf</outputDirectory>
34+
</outputTarget>
35+
</outputTargets>
36+
</configuration>
37+
</execution>
38+
</executions>
39+
</plugin>
40+
</plugins>
41+
</build>
42+
43+
<dependencies>
44+
<dependency>
45+
<groupId>com.google.protobuf</groupId>
46+
<artifactId>protobuf-java</artifactId>
47+
<version>3.11.1</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.oracle.oci.sdk</groupId>
51+
<artifactId>oci-java-sdk-common</artifactId>
52+
<version>1.13.1</version>
53+
</dependency>
54+
</dependencies>
55+
56+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.auth.sasl;
5+
6+
import com.oracle.bmc.auth.BasicAuthenticationDetailsProvider;
7+
import com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider;
8+
import java.util.Map;
9+
10+
/**
11+
* A {@link javax.security.auth.spi.LoginModule} that will use Instance Principals to fill the {@link javax.security.auth.Subject} credentials.
12+
* An <i>intent</i> parameter has to be specified - this service specific and is documented on a per-service basis.
13+
* <pre>{@code com.oracle.bmc.auth.sasl.InstancePrincipalsLoginModule required intent="<intent>";}</pre>
14+
*/
15+
public class InstancePrincipalsLoginModule extends OciLoginModule {
16+
@Override
17+
protected BasicAuthenticationDetailsProvider loadAuthenticationProvider(
18+
Map<String, ?> options) {
19+
return InstancePrincipalsAuthenticationDetailsProvider.builder().build();
20+
}
21+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.auth.sasl;
5+
6+
import com.oracle.bmc.auth.BasicAuthenticationDetailsProvider;
7+
import java.io.IOException;
8+
import javax.security.auth.Subject;
9+
import javax.security.auth.callback.Callback;
10+
import javax.security.auth.callback.CallbackHandler;
11+
import javax.security.auth.callback.NameCallback;
12+
import javax.security.auth.callback.UnsupportedCallbackException;
13+
14+
/**
15+
* Callback to handle in the SASL callback handler used when creating a {@link javax.security.sasl.SaslClient} using the OCI SASL mechanism.
16+
* Here's the code for a possible {@link CallbackHandler}:
17+
* <pre>{@code
18+
* public class OciSaslClientCallBackHandler implements CallbackHandler {
19+
*
20+
* private final Subject subject;
21+
*
22+
* public OciSaslClientCallBackHandler(Subject subject) {
23+
* this.subject = subject;
24+
* }
25+
*
26+
* @Override
27+
* public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
28+
* for (Callback callback : callbacks) {
29+
* if (callback instanceof OciAuthProviderCallback) {
30+
* BasicAuthenticationDetailsProvider authProvider =
31+
* subject.getPrivateCredentials(BasicAuthenticationDetailsProvider.class).iterator().next();
32+
* ((OciAuthProviderCallback) callback).authProvider(authProvider);
33+
* } else if (callback instanceof NameCallback) {
34+
* String intent = subject.getPublicCredentials(String.class).iterator().next();
35+
* ((NameCallback) callback).setName(intent);
36+
* } else {
37+
* throw new UnsupportedCallbackException(callback, "Unrecognized SASL ClientCallback");
38+
* }
39+
* }
40+
* }
41+
* }
42+
* }</pre>
43+
*/
44+
public class OciAuthProviderCallback implements Callback {
45+
private BasicAuthenticationDetailsProvider authProvider;
46+
47+
/**
48+
* Gets the associated {@link BasicAuthenticationDetailsProvider}
49+
*/
50+
public BasicAuthenticationDetailsProvider authProvider() {
51+
return authProvider;
52+
}
53+
54+
/**
55+
* Sets the provided {@link BasicAuthenticationDetailsProvider}
56+
*/
57+
public void authProvider(BasicAuthenticationDetailsProvider authProvider) {
58+
this.authProvider = authProvider;
59+
}
60+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.auth.sasl;
5+
6+
import com.oracle.bmc.auth.BasicAuthenticationDetailsProvider;
7+
import java.util.Map;
8+
import javax.security.auth.Subject;
9+
import javax.security.auth.callback.CallbackHandler;
10+
import javax.security.auth.spi.LoginModule;
11+
12+
abstract class OciLoginModule implements LoginModule {
13+
14+
private static final String INTENT_CONFIG = "intent";
15+
16+
static {
17+
OciSaslClientProvider.initialize();
18+
}
19+
20+
@Override
21+
public void initialize(
22+
Subject subject,
23+
CallbackHandler callbackHandler,
24+
Map<String, ?> sharedState,
25+
Map<String, ?> options) {
26+
27+
final String intent = (String) options.get(INTENT_CONFIG);
28+
if (intent == null) {
29+
throw new IllegalArgumentException("Intent is required.");
30+
}
31+
32+
// The intent is considered a public credential (use NameCallback to retrieve)
33+
subject.getPublicCredentials().add(intent);
34+
35+
final BasicAuthenticationDetailsProvider authProvider = loadAuthenticationProvider(options);
36+
37+
// Because Kafka doesn't allow using a custom callback handler and requires the password to be a string
38+
// we will map the auth provider to a UUID and use the cache key as a private credential.
39+
// The SASL client will retrieve the auth provider using the key.
40+
final String cacheKey = OciSaslClient.AuthProviderCache.cache(authProvider);
41+
subject.getPrivateCredentials().add(cacheKey);
42+
// We will also add it as the full instance for newer SASL clients that can control their callback handler.
43+
// The callback handler will need to handle callback of type OciAuthProviderCallback.
44+
subject.getPrivateCredentials().add(authProvider);
45+
}
46+
47+
protected abstract BasicAuthenticationDetailsProvider loadAuthenticationProvider(
48+
Map<String, ?> options);
49+
50+
@Override
51+
public boolean login() {
52+
return true;
53+
}
54+
55+
@Override
56+
public boolean commit() {
57+
return true;
58+
}
59+
60+
@Override
61+
public boolean abort() {
62+
return false;
63+
}
64+
65+
@Override
66+
public boolean logout() {
67+
return true;
68+
}
69+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.auth.sasl;
5+
6+
import com.oracle.bmc.http.signing.internal.Algorithm;
7+
import java.util.Collection;
8+
import java.util.Collections;
9+
import java.util.HashMap;
10+
import java.util.Map;
11+
12+
/**
13+
* Defines all the supports OCI SASL mechanisms.
14+
*/
15+
public enum OciMechanism {
16+
OCI_RSA_SHA256(Algorithm.RSAPSS256);
17+
18+
private final String mechanismName;
19+
private final Algorithm algorithm;
20+
21+
private static final Map<String, OciMechanism> MECHANISMS_MAP;
22+
23+
static {
24+
Map<String, OciMechanism> map = new HashMap<>();
25+
for (OciMechanism mechanism : values()) {
26+
map.put(mechanism.mechanismName, mechanism);
27+
}
28+
MECHANISMS_MAP = Collections.unmodifiableMap(map);
29+
}
30+
31+
public static OciMechanism fromMechanismName(String mechanismName) {
32+
return MECHANISMS_MAP.get(mechanismName);
33+
}
34+
35+
public static Collection<String> mechanismNames() {
36+
return MECHANISMS_MAP.keySet();
37+
}
38+
39+
public static boolean isOci(String mechanismName) {
40+
return MECHANISMS_MAP.containsKey(mechanismName);
41+
}
42+
43+
OciMechanism(Algorithm algorithm) {
44+
this.mechanismName = "OCI-" + algorithm.getSpecName().toUpperCase();
45+
this.algorithm = algorithm;
46+
}
47+
48+
public String mechanismName() {
49+
return mechanismName;
50+
}
51+
52+
public Algorithm algorithm() {
53+
return algorithm;
54+
}
55+
}

0 commit comments

Comments
 (0)