Skip to content

Commit

Permalink
AWS SDK for Android 2.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
AWS committed Aug 11, 2017
1 parent 6591694 commit c5067e0
Show file tree
Hide file tree
Showing 40 changed files with 199 additions and 156 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Change Log - AWS SDK for Android

## [Release 2.4.7](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.4.7)

### Improvements:

- **Amazon Cognito Auth**
- Making Cognito App Integration and Federation feature generally available

- **AWS IoT**
- Add API to enable/disable auto-resubscribe feature.

### Bug Fixes:

- **AWS IoT**
- Fixed bug that caused reconnecting to the session to throw an exception due to failure to obtain credentials.

## [Release 2.4.6](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.4.6)

### Bug Fixes:
Expand All @@ -13,6 +28,8 @@

## [Release 2.4.5](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.4.5)

### Bug Fixes:

- **Amazon S3**
- Fixed bug that caused keys to convert spaces to url encoded characters. See [issue #310](https://github.com/aws/aws-sdk-android/issues/310)

Expand Down
4 changes: 2 additions & 2 deletions aws-android-sdk-apigateway-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-pom</artifactId>
<version>2.4.6</version>
<version>2.4.7</version>
</parent>

<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-core</artifactId>
<optional>false</optional>
<version>2.4.6</version>
<version>2.4.7</version>
</dependency>
</dependencies>

Expand Down
4 changes: 2 additions & 2 deletions aws-android-sdk-autoscaling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-pom</artifactId>
<version>2.4.6</version>
<version>2.4.7</version>
</parent>

<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-core</artifactId>
<optional>false</optional>
<version>2.4.6</version>
<version>2.4.7</version>
</dependency>
</dependencies>

Expand Down
4 changes: 2 additions & 2 deletions aws-android-sdk-cloudwatch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-pom</artifactId>
<version>2.4.6</version>
<version>2.4.7</version>
</parent>

<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-core</artifactId>
<optional>false</optional>
<version>2.4.6</version>
<version>2.4.7</version>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions aws-android-sdk-cognito/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<artifactId>aws-android-sdk-cognito</artifactId>
<packaging>jar</packaging>
<name>AWS SDK for Android - Amazon Cognito Sync</name>
<version>2.4.6</version>
<version>2.4.7</version>
<description>The AWS Android SDK for Amazon Cognito Sync module holds the client classes that are used for communicating with Amazon Cognito Sync Service</description>
<url>http://aws.amazon.com/sdkforandroid</url>

<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-pom</artifactId>
<version>2.4.6</version>
<version>2.4.7</version>
</parent>

<licenses>
Expand All @@ -29,7 +29,7 @@
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-core</artifactId>
<optional>false</optional>
<version>2.4.6</version>
<version>2.4.7</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fabric-identifier=com.amazonaws.aws-android-sdk-cognito
fabric-version=2.4.6
fabric-version=2.4.7
fabric-build-type=binary
4 changes: 2 additions & 2 deletions aws-android-sdk-cognitoauth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<artifactId>aws-android-sdk-cognitoauth</artifactId>
<packaging>aar</packaging>
<name>AWS SDK for Android - Amazon Cognito Auth</name>
<version>2.4.6</version>
<version>2.4.7</version>
<description>The AWS Android SDK with app integration for Amazon Cognito Your User Pools Service</description>
<url>http://aws.amazon.com/sdkforandroid</url>

<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-pom</artifactId>
<version>2.4.6</version>
<version>2.4.7</version>
</parent>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ public void run() {
final Uri fqdn = new Uri.Builder()
.scheme(ClientConstants.DOMAIN_SCHEME)
.authority(pool.getAppWebDomain())
.appendPath(ClientConstants.DOMAIN_PATH_OAUTH2)
.appendPath(ClientConstants.DOMAIN_PATH_TOKEN_ENDPOINT)
.build();

Expand Down Expand Up @@ -287,10 +288,10 @@ public void run() {
String response =
httpClient.httpPost(new URL(fqdn.toString()), httpHeaderParams, httpBodyParams);
final AuthUserSession session = AuthHttpResponseParser.parseHttpResponse(response);
final String username = session.getUsername();
userId = session.getUsername();

// Cache tokens if successful
LocalDataManager.cacheSession(context, pool.getAppId(), username, session, tokenScopes);
LocalDataManager.cacheSession(context, pool.getAppId(), userId, session, tokenScopes);

// Return tokens
returnCallback = new Runnable() {
Expand Down Expand Up @@ -350,6 +351,7 @@ public void run() {
final Uri fqdn = new Uri.Builder()
.scheme(ClientConstants.DOMAIN_SCHEME)
.authority(pool.getAppWebDomain())
.appendPath(ClientConstants.DOMAIN_PATH_OAUTH2)
.appendPath(ClientConstants.DOMAIN_PATH_TOKEN_ENDPOINT)
.build();

Expand Down Expand Up @@ -461,7 +463,9 @@ private void launchCognitoAuth(final String redirectUri, final Set<String> token
// Build the complete web domain to launch the login screen
Uri.Builder builder = new Uri.Builder()
.scheme(ClientConstants.DOMAIN_SCHEME)
.authority(pool.getAppWebDomain()).appendPath(ClientConstants.DOMAIN_PATH_SIGN_IN)
.authority(pool.getAppWebDomain())
.appendPath(ClientConstants.DOMAIN_PATH_OAUTH2)
.appendPath(ClientConstants.DOMAIN_PATH_SIGN_IN)
.appendQueryParameter(ClientConstants.DOMAIN_QUERY_PARAM_CLIENT_ID, pool.getAppId())
.appendQueryParameter(ClientConstants.DOMAIN_QUERY_PARAM_REDIRECT_URI, redirectUri)
.appendQueryParameter(ClientConstants.DOMAIN_QUERY_PARAM_RESPONSE_TYPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
Expand All @@ -39,67 +40,76 @@

public final class AuthHttpClient {

public String httpPost(final URL uri, final Map<String, String> headerParams, final Map<String, String> bodyParams) throws Exception {
if (uri == null || bodyParams == null || bodyParams.size() < 1 ) {
throw new AuthClientException("Invalid http request parameters");
}

final HttpsURLConnection httpsURLConnection = (HttpsURLConnection) uri.openConnection();
DataOutputStream httpOutputStream = null;
BufferedReader br = null;
try {
// Request header
httpsURLConnection.setRequestMethod(ClientConstants.HTTP_REQUEST_TYPE_POST);
httpsURLConnection.setDoOutput(true);
for (Map.Entry<String, String> param: headerParams.entrySet()) {
httpsURLConnection.addRequestProperty(param.getKey(), param.getValue());
}

// Request body
StringBuilder reqBuilder = new StringBuilder();
int index = bodyParams.size();
for (Map.Entry<String, String> param: bodyParams.entrySet()) {
reqBuilder.append(URLEncoder.encode(param.getKey(), "UTF-8")).append('=').append(URLEncoder.encode(param.getValue(), "UTF-8"));
if(index-- > 1){
reqBuilder.append('&');
}
}
String requestBody = reqBuilder.toString();

httpOutputStream = new DataOutputStream(httpsURLConnection.getOutputStream());

httpOutputStream.writeBytes(requestBody);
httpOutputStream.flush();

// Parse response
Map<String, List<String>> respHeaders = httpsURLConnection.getHeaderFields();

int responseCode = httpsURLConnection.getResponseCode();

if (responseCode >= HttpURLConnection.HTTP_OK &&
responseCode < HttpURLConnection.HTTP_INTERNAL_ERROR) {
// Return response from the http call
br = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
String line = "";
StringBuilder responseOutput = new StringBuilder();
while ((line = br.readLine()) != null) {
responseOutput.append(line);
}
return responseOutput.toString();
} else {
// Throw a Cognito Client Exception
throw new AuthServiceException(httpsURLConnection.getResponseMessage());
}

} catch (final Exception e) {
throw e;
} finally {
if (httpOutputStream != null) {
httpOutputStream.close();
}
if (br != null) {
br.close();
}
}
}
public String httpPost(final URL uri, final Map<String, String> headerParams, final Map<String, String> bodyParams) throws Exception {
if (uri == null || bodyParams == null || bodyParams.size() < 1 ) {
throw new AuthClientException("Invalid http request parameters");
}

final HttpsURLConnection httpsURLConnection = (HttpsURLConnection) uri.openConnection();
DataOutputStream httpOutputStream = null;
BufferedReader br = null;
try {
// Request header
httpsURLConnection.setRequestMethod(ClientConstants.HTTP_REQUEST_TYPE_POST);
httpsURLConnection.setDoOutput(true);
for (Map.Entry<String, String> param: headerParams.entrySet()) {
httpsURLConnection.addRequestProperty(param.getKey(), param.getValue());
}

// Request body
StringBuilder reqBuilder = new StringBuilder();
int index = bodyParams.size();
for (Map.Entry<String, String> param: bodyParams.entrySet()) {
reqBuilder.append(URLEncoder.encode(param.getKey(), "UTF-8")).append('=').append(URLEncoder.encode(param.getValue(), "UTF-8"));
if(index-- > 1){
reqBuilder.append('&');
}
}
String requestBody = reqBuilder.toString();

httpOutputStream = new DataOutputStream(httpsURLConnection.getOutputStream());

httpOutputStream.writeBytes(requestBody);
httpOutputStream.flush();

// Parse response
Map<String, List<String>> respHeaders = httpsURLConnection.getHeaderFields();

int responseCode = httpsURLConnection.getResponseCode();

if (responseCode >= HttpURLConnection.HTTP_OK &&
responseCode < HttpURLConnection.HTTP_INTERNAL_ERROR) {

// Return response from the http call
InputStream httpDataStream;
if (responseCode < HttpURLConnection.HTTP_BAD_REQUEST) {
httpDataStream = httpsURLConnection.getInputStream();
} else {
httpDataStream = httpsURLConnection.getErrorStream();
}
br = new BufferedReader(new InputStreamReader(httpDataStream));

String line = "";
StringBuilder responseOutput = new StringBuilder();
while ((line = br.readLine()) != null) {
responseOutput.append(line);
}

return responseOutput.toString();
} else {
// Throw a Cognito Client Exception
throw new AuthServiceException(httpsURLConnection.getResponseMessage());
}

} catch (final Exception e) {
throw e;
} finally {
if (httpOutputStream != null) {
httpOutputStream.close();
}
if (br != null) {
br.close();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public abstract class ClientConstants {
public static final String AUTH_RESPONSE_TYPE_CODE = "code";
public static final String CHROME_PACKAGE = "com.android.chrome";
public static final int CHROME_NAVIGATION_CANCELLED = 6;
public static final String DOMAIN_PATH_OAUTH2 = "oauth2";
public static final String DOMAIN_PATH_SIGN_IN = "authorize";
public static final String DOMAIN_PATH_SIGN_OUT = "logout";
public static final String DOMAIN_PATH_TOKEN_ENDPOINT = "token";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ public final static String encodeBase64(String str) {
return null;
}
byte[] data = str.getBytes(Charset.forName("ISO-8859-1"));
return Base64.encodeToString(data, Base64.DEFAULT);
return Base64.encodeToString(data, Base64.NO_PADDING);
}
}
6 changes: 3 additions & 3 deletions aws-android-sdk-cognitoidentityprovider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<artifactId>aws-android-sdk-cognitoidentityprovider</artifactId>
<packaging>jar</packaging>
<name>AWS SDK for Android - Amazon Cognito Identity Provider</name>
<version>2.4.6</version>
<version>2.4.7</version>
<description>The AWS Android SDK for Amazon Cognito Identity Provider module holds the client classes that are used for communicating with Amazon Cognito Identity Provider Service</description>
<url>http://aws.amazon.com/sdkforandroid</url>

<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-pom</artifactId>
<version>2.4.6</version>
<version>2.4.7</version>
</parent>

<licenses>
Expand All @@ -29,7 +29,7 @@
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-core</artifactId>
<optional>false</optional>
<version>2.4.6</version>
<version>2.4.7</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
Expand Down
2 changes: 1 addition & 1 deletion aws-android-sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-android-sdk-pom</artifactId>
<version>2.4.6</version>
<version>2.4.7</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class VersionInfoUtils {
private static final int DEFAULT_STRING_LENGTH = 128;

/** SDK version info */
private static volatile String version = "2.4.6";
private static volatile String version = "2.4.7";
// changed build
// logic

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fabric-identifier=com.amazonaws.aws-android-sdk-core
fabric-version=2.4.6
fabric-version=2.4.7
fabric-build-type=binary
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class VersionInfoUtilsTest {

@Test
public void getVersion() {
assertEquals("2.4.6", VersionInfoUtils.getVersion());
assertEquals("2.4.7", VersionInfoUtils.getVersion());
}

@Test
Expand Down

0 comments on commit c5067e0

Please sign in to comment.