summaryrefslogtreecommitdiff
path: root/server/core/Identity.php
diff options
context:
space:
mode:
Diffstat (limited to 'server/core/Identity.php')
-rwxr-xr-xserver/core/Identity.php59
1 files changed, 47 insertions, 12 deletions
diff --git a/server/core/Identity.php b/server/core/Identity.php
index 1dc8373..df07f5d 100755
--- a/server/core/Identity.php
+++ b/server/core/Identity.php
@@ -53,7 +53,10 @@ class identity implements Core{
* Create a secret/access pair for use with ec2 style auth.
* This operation will generates a new set of credentials that map the user/project pair.
*
- * @throws [Type] [<description>]
+ * @param JsonString $blob credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}"
+ * @param String $projectId project's UUID
+ * @param String $type Type of credential : ec2, cert...
+ * @param String $userId Id of the user which own the credential
*
* @return void
*/
@@ -73,36 +76,68 @@ class identity implements Core{
$opt = array('blob' => $blob, 'projectId' => $projectId, 'type' => $type, 'userId' => $userId);
$res = $this->libClass->createCredential($opt);
- }catch(Exception $e){
-
- }
-
- ]
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance->NotImplementedHandler($e);
+ }
}
/**
* List the credentials for a given user.
*
- * @throws [Type] [<description>]
- *
* @return void
*/
$credentials["listCredentials"] = function(){
-
+ try{
+
+ $this->libClass->listCredentials()
+
+ //TODO parse answer
+
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance->NotImplementedHandler($e);
+ }
}
/**
* Retrieve a user’s access/secret pair by the access key.
*
- * @throws [Type] [<description>]
+ * @param String $credentialId credential id for which it retrieve the details
*
* @return void
*/
$credentials["showCredential"] = function(){
- $credential = $identity->getCredential('credentialId');
-$credential->retrieve();
+ $credentId = $this->app->getPostParam("credentialId");
+
+ try{
+
+ $cred = $this->libClass->getCredential($credentId);
+ $cred->retrieve();
+
+ //TODO parse answer
+
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance->NotImplementedHandler($e);
+ }
}