Esempio n. 1
0
 public function getApiKey($apiKeyId, $options = array())
 {
     $options['id'] = $apiKeyId;
     $apiKeyOptions = new ApiKeyEncryptionOptions($options);
     $options = array_merge($options, $apiKeyOptions->toArray());
     $apiKeyList = $this->getDataStore()->getResource($this->getHref() . '/' . ApiKey::PATH, Stormpath::API_KEY_LIST, $options);
     $iterator = $apiKeyList->iterator;
     $apiKey = $iterator->valid() ? $iterator->current() : null;
     if ($apiKey) {
         $apiKey->setApiKeyMetadata($apiKeyOptions);
     }
     return $apiKey;
 }
Esempio n. 2
0
 public function createApiKey($options = array())
 {
     $apiKeyOptions = new ApiKeyEncryptionOptions($options);
     $options = array_merge($options, $apiKeyOptions->toArray());
     $apiKey = $this->getDataStore()->instantiate(Stormpath::API_KEY);
     $apiKey = $this->getDataStore()->create($this->getHref() . '/' . ApiKey::PATH, $apiKey, Stormpath::API_KEY, $options);
     if ($apiKey) {
         $apiKey->setApiKeyMetadata($apiKeyOptions);
     }
     return $apiKey;
 }