Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(SecurityTokenServiceAssumeRoleWithWebIdentityResponse *)getAmazonSecurityTokenServiceWithAWSRoleResource:(NSString*)roleResourceName {
- //get Amazon Security Token Service With AWS Role Resource for Facebook
- SecurityTokenServiceAssumeRoleWithWebIdentityRequest *awsSTRequest = [[SecurityTokenServiceAssumeRoleWithWebIdentityRequest alloc] init];
- awsSTRequest.roleArn = roleResourceName;
- awsSTRequest.roleSessionName = userFacebookID;
- awsSTRequest.webIdentityToken = FBAccessToken;
- awsSTRequest.providerId = @"graph.facebook.com";
- AmazonSecurityTokenServiceClient *awsTSClient = [[AmazonSecurityTokenServiceClient alloc] init];
- SecurityTokenServiceAssumeRoleWithWebIdentityResponse *response = [awsTSClient assumeRoleWithWebIdentity:awsSTRequest];
- return response;
- }
- -(void)initializeAmazonDBClient {
- //Get security token for Facebook user
- SecurityTokenServiceAssumeRoleWithWebIdentityResponse *awsSTResponse = [appDelegate.facebookManager getAmazonSecurityTokenServiceWithAWSRoleResource:AWSDBROLERESOURCENAMEFACEBOOK];
- //initialize awsCredentials
- AmazonCredentials *awsCredentials = [[AmazonCredentials alloc] initWithAccessKey:awsSTResponse.credentials.accessKeyId withSecretKey:awsSTResponse.credentials.secretAccessKey withSecurityToken:awsSTResponse.credentials.sessionToken];
- //Initialize AmazonDynamoDBClient for sending requests to Amazon
- self.awsDBClient = [[AmazonDynamoDBClient alloc] initWithCredentials:awsCredentials];
- self.awsDBClient.endpoint = AMAZONDYNAMODBENDPOINT;
- //set up a DynamoDBDescribeTableRequest request
- DynamoDBDescribeTableRequest *request = [[DynamoDBDescribeTableRequest alloc] initWithTableName:@"my_table_name"];
- request.delegate = self;
- DynamoDBDescribeTableResponse *response = [awsDBClient describeTable:request];
- NSString *status = response.table.tableStatus;
- NSLog(@"%@", status); //NULL
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement