From fe76195f1d9645563928d2e589c305298316ceeb Mon Sep 17 00:00:00 2001 From: Robin Lu Date: Tue, 5 Jun 2012 15:38:32 +0800 Subject: [PATCH] support temporary security crendentials --- Classes/S3/ASIS3Request.h | 4 ++++ Classes/S3/ASIS3Request.m | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index 913aef9d..37e443fa 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -52,6 +52,9 @@ typedef enum _ASIS3ErrorType { // The access policy to use when PUTting a file (see the string constants at the top ASIS3Request.h for details on what the possible options are) NSString *accessPolicy; + + // The session token used by Temporary Security Credentials + NSString *sessionToken; // Internally used while parsing errors NSString *currentXMLElementContent; @@ -106,4 +109,5 @@ typedef enum _ASIS3ErrorType { @property (retain) NSString *currentXMLElementContent; @property (retain) NSMutableArray *currentXMLElementStack; @property (retain) NSString *requestScheme; +@property (retain) NSString *sessionToken; @end diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index d07000c9..a439b1f9 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -48,6 +48,7 @@ - (void)dealloc [secretAccessKey release]; [accessPolicy release]; [requestScheme release]; + [sessionToken release]; [super dealloc]; } @@ -71,6 +72,9 @@ - (NSMutableDictionary *)S3Headers if ([self accessPolicy]) { [headers setObject:[self accessPolicy] forKey:@"x-amz-acl"]; } + if (self.sessionToken) { + [headers setObject:[self sessionToken] forKey:@"x-amz-security-token"]; + } return headers; } @@ -309,4 +313,5 @@ - (void)buildURL @synthesize currentXMLElementStack; @synthesize accessPolicy; @synthesize requestScheme; +@synthesize sessionToken; @end