Skip to content

Commit

Permalink
'Version 1.0.009 of the AWS Java SDK'
Browse files Browse the repository at this point in the history
Added support for the new AWS Identity and Access Management service, new API for easily constructing AWS access control policies, and improved retry handling for transient errors.

For complete release notes, see:
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=4129
  • Loading branch information
AWS committed Sep 3, 2010
1 parent 7cce2b1 commit a936bdb
Show file tree
Hide file tree
Showing 237 changed files with 32,621 additions and 2,339 deletions.
10 changes: 10 additions & 0 deletions LICENSE.txt
Expand Up @@ -51,3 +51,13 @@ You may add Your own copyright statement to Your modifications and may provide a
END OF TERMS AND CONDITIONS

Note: Other license terms may apply to certain, identified software files contained within or distributed with the accompanying software if such terms are included in the directory containing the accompanying software. Such other license terms will then apply in lieu of the terms of the software license above.

JSON processing code subject to the JSON License from JSON.org:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions NOTICE.txt
Expand Up @@ -9,5 +9,6 @@ THIRD PARTY COMPONENTS
**********************
This software includes third party software subject to the following copyrights:
- XML parsing and utility functions from JetS3t - Copyright 2006-2009 James Murty.
- JSON parsing and utility functions from JSON.org - Copyright 2002 JSON.org.

The licenses for these third party components are included in LICENSE.txt
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -6,7 +6,7 @@
<artifactId>aws-java-sdk</artifactId>
<packaging>jar</packaging>
<name>AWS SDK for Java</name>
<version>1.0.008</version>
<version>1.0.009</version>
<description>The Amazon Web Services SDK for Java provides Java APIs for building software on AWS’ cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).</description>
<url>http://aws.amazon.com/sdkforjava</url>

Expand Down
11 changes: 9 additions & 2 deletions src/main/java/com/amazonaws/auth/AWS3Signer.java
Expand Up @@ -89,11 +89,18 @@ public void sign(Request<?> request) throws SignatureException {
}
log.debug("Calculated StringToSign: " + stringToSign);

String signature = sign(stringToSign, credentials.getAWSSecretKey(), algorithm);
String accessKeyId = null;
String secretKey = null;
synchronized (credentials) {
accessKeyId = credentials.getAWSAccessKeyId();
secretKey = credentials.getAWSSecretKey();
}

String signature = sign(stringToSign, secretKey, algorithm);

StringBuilder builder = new StringBuilder();
builder.append(isHttps ? HTTPS_SCHEME : HTTP_SCHEME).append(" ");
builder.append("AWSAccessKeyId=" + credentials.getAWSAccessKeyId() + ",");
builder.append("AWSAccessKeyId=" + accessKeyId + ",");
builder.append("Algorithm=" + algorithm.toString() + ",");
builder.append("Signature=" + signature);

Expand Down
13 changes: 10 additions & 3 deletions src/main/java/com/amazonaws/auth/QueryStringSigner.java
Expand Up @@ -81,7 +81,15 @@ public void sign(Request<?> request) throws SignatureException {
*/
public void sign(Request<?> request, SignatureVersion version,
SigningAlgorithm algorithm) throws SignatureException {
request.addParameter("AWSAccessKeyId", credentials.getAWSAccessKeyId());
String secretKey;
String accessKeyId;
synchronized (credentials) {
secretKey = credentials.getAWSSecretKey();
accessKeyId = credentials.getAWSAccessKeyId();
}


request.addParameter("AWSAccessKeyId", accessKeyId);
request.addParameter("SignatureVersion", version.toString());
request.addParameter("Timestamp", getFormattedTimestamp());

Expand All @@ -98,8 +106,7 @@ else if ( version.equals( SignatureVersion.V2 ) ) {
throw new SignatureException("Invalid Signature Version specified");
}

String signatureValue = sign(stringToSign, credentials
.getAWSSecretKey(), algorithm);
String signatureValue = sign(stringToSign, secretKey, algorithm);
request.addParameter("Signature", signatureValue);
}

Expand Down
47 changes: 47 additions & 0 deletions src/main/java/com/amazonaws/auth/policy/Action.java
@@ -0,0 +1,47 @@
/*
* Copyright 2010 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.auth.policy;

/**
* An access control policy action identifies a specific action in a service
* that can be performed on a resource. For example, sending a message to a
* queue.
* <p>
* Actions allow you to limit what your access control policy statement affects.
* For example, you could create a policy statement that enables a certain group
* of users to send messages to your queue, but not allow them to perform any
* other actions on your queue.
* <p>
* The action is B in the statement
* "A has permission to do B to C where D applies."
* <p>
* Free form access control policy actions may include a wildcard (*) to match
* multiple actions.
* <p>
* This class is not intended to be directly implemented, instead developers
* should see the classes available in com.amazonaws.auth.policy.actions for
* more information on the available actions for each service.
*/
public interface Action {

/**
* Returns the name of this action. For example, 'sqs:SendMessage' is the
* name corresponding to the SQS action that enables users to send a message
* to an SQS queue.
*
* @return The name of this action.
*/
public String getActionName();
}
148 changes: 148 additions & 0 deletions src/main/java/com/amazonaws/auth/policy/Condition.java
@@ -0,0 +1,148 @@
/*
* Copyright 2010 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.auth.policy;

import java.util.List;

import com.amazonaws.auth.policy.conditions.ConditionFactory;
import com.amazonaws.auth.policy.conditions.NumericCondition;
import com.amazonaws.auth.policy.conditions.NumericCondition.NumericComparisonType;

/**
* AWS access control policy conditions are contained in {@link Statement}
* objects, and affect when a statement is applied. For example, a statement
* that allows access to an Amazon SQS queue could use a condition to only apply
* the effect of that statement for requests that are made before a certain
* date, or that originate from a range of IP addresses.
* <p>
* Multiple conditions can be included in a single statement, and all conditions
* must evaluate to true in order for the statement to take effect.
* <p>
* The set of conditions is D in the statement
* "A has permission to do B to C where D applies."
* <p>
* A condition is composed of three parts:
* <ul>
* <li><b>Condition Key</b> - The condition key declares which value of a
* request to pull in and compare against when a policy is evaluated by AWS. For
* example, using {@link ConditionFactory#SOURCE_IP_CONDITION_KEY} will cause
* AWS to pull in the current request's source IP as the first value to compare
* against every time your policy is evaluated.
* <li><b>Comparison Type</b> - Most condition types allow several ways to
* compare the value obtained from the condition key and the comparison value.
* For example, the {@link NumericComparisonType} enumerates the ways a
* {@link NumericCondition} can be evaluated (less than, greater than, equals,
* etc).
* <li><b>Comparison Value</b> - This is a static value used as the second value
* in the comparison when your policy is evaluated. Depending on the comparison
* type, this value can optionally use wildcards. See the documentation for
* individual comparison types for more information.
* </ul>
* <p>
* There are many expressive conditions available in the
* <code>com.amazonaws.auth.policy.conditions</code> package to use in access
* control policy statements.
* <p>
* This class is not intended to be directly subclassed by users, instead users
* should use the many available conditions and condition factories in the
* com.amazonaws.auth.policy.conditions package.
*/
public abstract class Condition {
protected String type;
protected String conditionKey;
protected List<String> values;

/**
* Returns the type of this condition.
*
* @return The type of this condition.
*/
public String getType() {
return type;
}

/**
* Sets the type of this condition.
*
* @param type
* The type of this condition.
*/
public void setType(String type) {
this.type = type;
}

/**
* Returns the name of the condition key involved in this condition.
* Condition keys are predefined values supported by AWS that provide input
* to a condition's evaluation, such as the current time, or the IP address
* of the incoming request.
* <p>
* Your policy is evaluated for each incoming request, and condition keys
* specify what information to pull out of those incoming requests and plug
* into the conditions in your policy.
*
* @return The name of the condition key involved in this condition.
*/
public String getConditionKey() {
return conditionKey;
}

/**
* Sets the name of the condition key involved in this condition.
* Condition keys are predefined values supported by AWS that provide
* input to a condition's evaluation, such as the current time, or the IP
* address of the incoming request.
* <p>
* Your policy is evaluated for each incoming request, and condition keys
* specify what information to pull out of those incoming requests and plug
* into the conditions in your policy.
*
* @param conditionKey
* The name of the condition key involved in this condition.
*/
public void setConditionKey(String conditionKey) {
this.conditionKey = conditionKey;
}

/**
* Returns the values specified for this access control policy condition.
* For example, in a condition that compares the incoming IP address of a
* request to a specified range of IP addresses, the range of IP addresses
* is the single value in the condition.
* <p>
* Most conditions accept only one value, but multiple values are possible.
*
* @return The values specified for this access control policy condition.
*/
public List<String> getValues() {
return values;
}

/**
* Sets the values specified for this access control policy condition. For
* example, in a condition that compares the incoming IP address of a
* request to a specified range of IP addresses, the range of IP addresses
* is the single value in the condition.
* <p>
* Most conditions accept only one value, but multiple values are possible.
*
* @param values
* The values specified for this access control policy condition.
*/
public void setValues(List<String> values) {
this.values = values;
}

}

0 comments on commit a936bdb

Please sign in to comment.