public function testThatAssumeRoleWithWebIdentityRequestsDoNotGetSigned()
 {
     $client = CognitoIdentityClient::factory(array('region' => 'us-east-1'));
     $mock = new MockPlugin();
     $mock->addResponse(new Response(200));
     $client->addSubscriber($mock);
     $command = $client->getCommand('GetId', array('AccountId' => '1234567890', 'IdentityPoolId' => 'abc:abc'));
     $request = $command->prepare();
     $command->execute();
     $this->assertFalse($request->hasHeader('Authorization'));
 }
예제 #2
0
 /**
  * Developer Cognito token (Used for AWS Micro services)
  */
 public function developerToken()
 {
     App::uses('CakeSession', 'Model/Datasource');
     $admin = CakeSession::read('admin_user');
     if (!empty($admin)) {
         if (YOUNIQUE_TESTSERVER === true) {
             if (defined('TEST_AWS_KEY') && defined('TEST_AWS_SECRET')) {
                 $options = ['key' => TEST_AWS_KEY, 'secret' => TEST_AWS_SECRET, 'region' => 'us-east-1'];
             } else {
                 return;
             }
         } else {
             $options = ['region' => 'us-east-1'];
         }
         $client = CognitoIdentityClient::factory($options);
         $result = $client->getOpenIdTokenForDeveloperIdentity(['IdentityPoolId' => "us-east-1:28eb7b2a-b494-4226-bbc6-5fbc059caee7", 'IdentityId' => null, 'Logins' => ['admin.youniqueproducts.com' => $admin->id], 'TokenDuration' => 960]);
         $result = ['identityId' => $result['IdentityId'], 'token' => $result['Token']];
     } else {
         $result = false;
     }
     $this->set(['result' => $result, '_serialize' => ['result']]);
 }