Skip to content

Commit a65c741

Browse files
author
Yosuke Matsuda
committed
The AWS Mobile SDK for iOS 2.0.13.
1 parent 7e9bcb9 commit a65c741

File tree

66 files changed

+4397
-2132
lines changed

Some content is hidden

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

66 files changed

+4397
-2132
lines changed

AWSCore/Authentication/AWSIdentityProvider.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,18 @@ typedef NS_ENUM(NSInteger, AWSCognitoIdentityProviderErrorType) {
6060

6161
@end
6262

63-
@interface AWSBasicCognitoIdentityProvider : AWSAbstractIdentityProvider
63+
@interface AWSAbstractCognitoIdentityProvider : AWSAbstractIdentityProvider
64+
65+
@property (nonatomic, strong, readonly) NSString *providerName;
66+
67+
- (instancetype)initWithRegionType:(AWSRegionType)regionType
68+
identityId:(NSString *)identityId
69+
accountId:(NSString *)accountId
70+
identityPoolId:(NSString *)identityPoolId
71+
logins:(NSDictionary *)logins;
72+
@end
73+
74+
@interface AWSBasicCognitoIdentityProvider : AWSAbstractCognitoIdentityProvider
6475

6576
- (instancetype)initWithRegionType:(AWSRegionType)regionType
6677
identityId:(NSString *)identityId

AWSCore/Authentication/AWSIdentityProvider.m

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,16 @@ - (void)postIdentityIdChangedNotification:(NSString *)newId {
117117

118118
@end
119119

120-
@interface AWSBasicCognitoIdentityProvider()
120+
@interface AWSAbstractCognitoIdentityProvider()
121121
@property (nonatomic, strong) NSString *accountId;
122+
@property (nonatomic, strong) NSString *providerName;
122123
@property (nonatomic, strong) AWSCognitoIdentity *cib;
123124
@property (nonatomic, strong) BFExecutor *executor;
124125
@property (atomic, assign) int32_t count;
125126
@property (nonatomic, strong) dispatch_semaphore_t semaphore;
126127
@end
127128

128-
@implementation AWSBasicCognitoIdentityProvider
129+
@implementation AWSAbstractCognitoIdentityProvider
129130
@synthesize accountId=_accountId;
130131

131132
- (instancetype)initWithRegionType:(AWSRegionType)regionType
@@ -169,7 +170,7 @@ - (BFTask *)getIdentityId {
169170
}
170171
else {
171172
dispatch_semaphore_wait(self.semaphore, dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC));
172-
return nil;
173+
return [BFTask taskWithResult:nil];
173174
}
174175
}] continueWithBlock:^id(BFTask *task) {
175176
self.count--;
@@ -263,8 +264,25 @@ - (BFTask *)refresh {
263264
self.identityId = identityIdFromToken;
264265
}
265266

266-
return nil;
267+
return [BFTask taskWithResult:nil];
267268
}];
268269
}
269270

270271
@end
272+
273+
@implementation AWSBasicCognitoIdentityProvider
274+
275+
- (instancetype)initWithRegionType:(AWSRegionType)regionType
276+
identityId:(NSString *)identityId
277+
accountId:(NSString *)accountId
278+
identityPoolId:(NSString *)identityPoolId
279+
logins:(NSDictionary *)logins {
280+
281+
282+
if (self = [super initWithRegionType:regionType identityId:identityId accountId:accountId identityPoolId:identityPoolId logins:logins]) {
283+
self.providerName = @"Cognito";
284+
}
285+
return self;
286+
}
287+
288+
@end

AWSCore/Authentication/AWSSignature.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ + (NSString *)hashString:(NSString *)stringToHash {
5050
}
5151

5252
+ (NSData *)hash:(NSData *)dataToHash {
53-
if ([dataToHash length] > UINT32_MAX)
54-
{
53+
if ([dataToHash length] > UINT32_MAX) {
5554
return nil;
5655
}
5756

AWSCore/CognitoIdentity/AWSCognitoIdentity.h

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@class BFTask;
2121

2222
/**
23-
* <fullname>Amazon Cognito</fullname><p>Amazon Cognito is a web service that delivers scoped temporary credentials to mobile devices andother untrusted environments. Amazon Cognito uniquely identifies a device and supplies the userwith a consistent identity over the lifetime of an application.</p><p>Using Amazon Cognito, you can enable authentication with one or more third-party identityproviders (Facebook, Google, or Login with Amazon), and you can also choose to supportunauthenticated access from your app. Cognito delivers a unique identifier for each userand acts as an OpenID token provider trusted by AWS Security Token Service (STS) to accesstemporary, limited-privilege AWS credentials.</p><p>To provide end-user credentials, first make an unsigned call to <a>GetId</a>. If the enduser is authenticated with one of the supported identity providers, set the <code>Logins</code> map with the identity provider token. <code>GetId</code> returns aunique identifier for the user.</p><p>Next, make an unsigned call to <a>GetOpenIdToken</a>, which returns the OpenID tokennecessary to call STS and retrieve AWS credentials. This call expects the same <code>Logins</code> map as the <code>GetId</code> call, as well as the <code>IdentityID</code> originally returned by <code>GetId</code>. The token returned by <code>GetOpenIdToken</code> can be passed to the STS operation <a href="http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">AssumeRoleWithWebIdentity</a> to retrieve AWS credentials.</p>
23+
* <fullname>Amazon Cognito</fullname><p>Amazon Cognito is a web service that delivers scoped temporary credentials to mobile devices and other untrusted environments. Amazon Cognito uniquely identifies a device and supplies the user with a consistent identity over the lifetime of an application.</p><p>Using Amazon Cognito, you can enable authentication with one or more third-party identity providers (Facebook, Google, or Login with Amazon), and you can also choose to support unauthenticated access from your app. Cognito delivers a unique identifier for each user and acts as an OpenID token provider trusted by AWS Security Token Service (STS) to access temporary, limited-privilege AWS credentials.</p><p>To provide end-user credentials, first make an unsigned call to <a>GetId</a>. If the end user is authenticated with one of the supported identity providers, set the <code>Logins</code> map with the identity provider token. <code>GetId</code> returns a unique identifier for the user.</p><p>Next, make an unsigned call to <a>GetOpenIdToken</a>, which returns the OpenID token necessary to call STS and retrieve AWS credentials. This call expects the same <code>Logins</code> map as the <code>GetId</code> call, as well as the <code>IdentityID</code> originally returned by <code>GetId</code>. The token returned by <code>GetOpenIdToken</code> can be passed to the STS operation <a href="http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html">AssumeRoleWithWebIdentity</a> to retrieve AWS credentials.</p>
2424
*/
2525
@interface AWSCognitoIdentity : AWSService
2626

@@ -31,7 +31,7 @@
3131
- (instancetype)initWithConfiguration:(AWSServiceConfiguration *)configuration;
3232

3333
/**
34-
* <p>Creates a new identity pool. The identity pool is a store of user identity information thatis specific to your AWS account. The limit on identity pools is 60 per account.</p>
34+
* <p>Creates a new identity pool. The identity pool is a store of user identity information that is specific to your AWS account. The limit on identity pools is 60 per account.</p>
3535
*
3636
* @param request A container for the necessary parameters to execute the CreateIdentityPool service method.
3737
*
@@ -43,7 +43,7 @@
4343
- (BFTask *)createIdentityPool:(AWSCognitoIdentityCreateIdentityPoolInput *)request;
4444

4545
/**
46-
* <p>Deletes a user pool. Once a pool is deleted, users will not be able to authenticate withthe pool.</p>
46+
* <p>Deletes a user pool. Once a pool is deleted, users will not be able to authenticate with the pool.</p>
4747
*
4848
* @param request A container for the necessary parameters to execute the DeleteIdentityPool service method.
4949
*
@@ -54,7 +54,7 @@
5454
- (BFTask *)deleteIdentityPool:(AWSCognitoIdentityDeleteIdentityPoolInput *)request;
5555

5656
/**
57-
* <p>Gets details about a particular identity pool, including the pool name, ID description,creation date, and current number of users.</p>
57+
* <p>Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.</p>
5858
*
5959
* @param request A container for the necessary parameters to execute the DescribeIdentityPool service method.
6060
*
@@ -66,7 +66,7 @@
6666
- (BFTask *)describeIdentityPool:(AWSCognitoIdentityDescribeIdentityPoolInput *)request;
6767

6868
/**
69-
* <p>Generates (or retrieves) a Cognito ID. Supplying multiple logins will create an implicitlinked account.</p>
69+
* <p>Generates (or retrieves) a Cognito ID. Supplying multiple logins will create an implicit linked account.</p>
7070
*
7171
* @param request A container for the necessary parameters to execute the GetId service method.
7272
*
@@ -78,7 +78,7 @@
7878
- (BFTask *)getId:(AWSCognitoIdentityGetIdInput *)request;
7979

8080
/**
81-
* <p>Gets an OpenID token, using a known Cognito ID. This known Cognito ID is returned by<a>GetId</a>. You can optionally add additional logins for the identity. Supplying multiple loginscreates an implicit link.</p><p>The OpenId token is valid for 15 minutes.</p>
81+
* <p>Gets an OpenID token, using a known Cognito ID. This known Cognito ID is returned by <a>GetId</a>. You can optionally add additional logins for the identity. Supplying multiple logins creates an implicit link.</p><p>The OpenId token is valid for 15 minutes.</p>
8282
*
8383
* @param request A container for the necessary parameters to execute the GetOpenIdToken service method.
8484
*
@@ -89,6 +89,16 @@
8989
*/
9090
- (BFTask *)getOpenIdToken:(AWSCognitoIdentityGetOpenIdTokenInput *)request;
9191

92+
/**
93+
* <p>Registers (or retrieves) a Cognito <code>IdentityId</code> and an OpenID Connect token for a user authenticated by your backend authentication process. Supplying multiple logins will create an implicit linked account. You can only specify one developer provider as part of the <code>Logins</code> map, which is linked to the identity pool. The developer provider is the "domain" by which Cognito will refer to your users.</p><p>You can use <code>GetOpenIdTokenForDeveloperIdentity</code> to create a new identity and to link new logins (that is, user credentials issued by a public provider or developer provider) to an existing identity. When you want to create a new identity, the <code>IdentityId</code> should be null. When you want to associate a new login with an existing authenticated/unauthenticated identity, you can do so by providing the existing <code>IdentityId</code>. This API will create the identity in the specified <code>IdentityPoolId</code>.</p>
94+
*
95+
* @param request A container for the necessary parameters to execute the GetOpenIdTokenForDeveloperIdentity service method.
96+
*
97+
* @return An instance of BFTask. On successful execution, task.result will contain an instance of AWSCognitoIdentityGetOpenIdTokenForDeveloperIdentityResponse. On failed execution, task.error may contain an NSError with AWSCognitoIdentityErrorDomain domian and the following error code: AWSCognitoIdentityErrorInvalidParameter, AWSCognitoIdentityErrorResourceNotFound, AWSCognitoIdentityErrorNotAuthorized, AWSCognitoIdentityErrorResourceConflict, AWSCognitoIdentityErrorTooManyRequests, AWSCognitoIdentityErrorInternalError, AWSCognitoIdentityErrorDeveloperUserAlreadyRegistered.
98+
*
99+
* @see AWSCognitoIdentityGetOpenIdTokenForDeveloperIdentityInput
100+
* @see AWSCognitoIdentityGetOpenIdTokenForDeveloperIdentityResponse
101+
*/
92102
- (BFTask *)getOpenIdTokenForDeveloperIdentity:(AWSCognitoIdentityGetOpenIdTokenForDeveloperIdentityInput *)request;
93103

94104
/**
@@ -115,14 +125,43 @@
115125
*/
116126
- (BFTask *)listIdentityPools:(AWSCognitoIdentityListIdentityPoolsInput *)request;
117127

128+
/**
129+
* <p>Retrieves the <code>IdentityID</code> associated with a <code>DeveloperUserIdentifier</code> or the list of <code>DeveloperUserIdentifier</code>s associated with an <code>IdentityId</code> for an existing identity. Either <code>IdentityID</code> or <code>DeveloperUserIdentifier</code> must not be null. If you supply only one of these values, the other value will be searched in the database and returned as a part of the response. If you supply both, <code>DeveloperUserIdentifier</code> will be matched against <code>IdentityID</code>. If the values are verified against the database, the response returns both values and is the same as the request. Otherwise a <code>ResourceConflictException</code> is thrown.</p>
130+
*
131+
* @param request A container for the necessary parameters to execute the LookupDeveloperIdentity service method.
132+
*
133+
* @return An instance of BFTask. On successful execution, task.result will contain an instance of AWSCognitoIdentityLookupDeveloperIdentityResponse. On failed execution, task.error may contain an NSError with AWSCognitoIdentityErrorDomain domian and the following error code: AWSCognitoIdentityErrorInvalidParameter, AWSCognitoIdentityErrorResourceNotFound, AWSCognitoIdentityErrorNotAuthorized, AWSCognitoIdentityErrorResourceConflict, AWSCognitoIdentityErrorTooManyRequests, AWSCognitoIdentityErrorInternalError.
134+
*
135+
* @see AWSCognitoIdentityLookupDeveloperIdentityInput
136+
* @see AWSCognitoIdentityLookupDeveloperIdentityResponse
137+
*/
118138
- (BFTask *)lookupDeveloperIdentity:(AWSCognitoIdentityLookupDeveloperIdentityInput *)request;
119139

140+
/**
141+
* <p>Merges two users having different <code>IdentityId</code>s, existing in the same identity pool, and identified by the same developer provider. You can use this action to request that discrete users be merged and identified as a single user in the Cognito environment. Cognito associates the given source user (<code>SourceUserIdentifier</code>) with the <code>IdentityId</code> of the <code>DestinationUserIdentifier</code>. Only developer-authenticated users can be merged. If the users to be merged are associated with the same public provider, but as two different users, an exception will be thrown.</p>
142+
*
143+
* @param request A container for the necessary parameters to execute the MergeDeveloperIdentities service method.
144+
*
145+
* @return An instance of BFTask. On successful execution, task.result will contain an instance of AWSCognitoIdentityMergeDeveloperIdentitiesResponse. On failed execution, task.error may contain an NSError with AWSCognitoIdentityErrorDomain domian and the following error code: AWSCognitoIdentityErrorInvalidParameter, AWSCognitoIdentityErrorResourceNotFound, AWSCognitoIdentityErrorNotAuthorized, AWSCognitoIdentityErrorResourceConflict, AWSCognitoIdentityErrorTooManyRequests, AWSCognitoIdentityErrorInternalError.
146+
*
147+
* @see AWSCognitoIdentityMergeDeveloperIdentitiesInput
148+
* @see AWSCognitoIdentityMergeDeveloperIdentitiesResponse
149+
*/
120150
- (BFTask *)mergeDeveloperIdentities:(AWSCognitoIdentityMergeDeveloperIdentitiesInput *)request;
121151

152+
/**
153+
* <p>Unlinks a <code>DeveloperUserIdentifier</code> from an existing identity. Unlinked developer users will be considered new identities next time they are seen. If, for a given Cognito identity, you remove all federated identities as well as the developer user identifier, the Cognito identity becomes inaccessible.</p>
154+
*
155+
* @param request A container for the necessary parameters to execute the UnlinkDeveloperIdentity service method.
156+
*
157+
* @return An instance of BFTask. On successful execution, task.result will be nil. On failed execution, task.error may contain an NSError with AWSCognitoIdentityErrorDomain domian and the following error code: AWSCognitoIdentityErrorInvalidParameter, AWSCognitoIdentityErrorResourceNotFound, AWSCognitoIdentityErrorNotAuthorized, AWSCognitoIdentityErrorResourceConflict, AWSCognitoIdentityErrorTooManyRequests, AWSCognitoIdentityErrorInternalError.
158+
*
159+
* @see AWSCognitoIdentityUnlinkDeveloperIdentityInput
160+
*/
122161
- (BFTask *)unlinkDeveloperIdentity:(AWSCognitoIdentityUnlinkDeveloperIdentityInput *)request;
123162

124163
/**
125-
* <p>Unlinks a federated identity from an existing account. Unlinked logins will be considerednew identities next time they are seen. Removing the last linked login will make thisidentity inaccessible.</p>
164+
* <p>Unlinks a federated identity from an existing account. Unlinked logins will be considered new identities next time they are seen. Removing the last linked login will make this identity inaccessible.</p>
126165
*
127166
* @param request A container for the necessary parameters to execute the UnlinkIdentity service method.
128167
*

AWSCore/CognitoIdentity/AWSCognitoIdentity.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#import "AWSURLResponseSerialization.h"
1515
#import "AWSURLRequestRetryHandler.h"
1616

17-
NSString *const AWSCIBDefinitionFileName = @"cib-2014-06-30";
17+
NSString *const AWSCIBDefinitionFileName = @"cognito-identity-2014-06-30";
1818

1919
@interface AWSCognitoIdentityResponseSerializer : AWSJSONResponseSerializer
2020

@@ -229,6 +229,7 @@ - (BFTask *)invokeRequest:(AWSRequest *)request
229229
}
230230

231231
#pragma mark - Service method
232+
232233
- (BFTask *)createIdentityPool:(AWSCognitoIdentityCreateIdentityPoolInput *)request {
233234
return [self invokeRequest:request
234235
HTTPMethod:AWSHTTPMethodPOST

0 commit comments

Comments
 (0)