Skip to content

Commit

Permalink
Merge pull request #639 from jniebuhr/develop
Browse files Browse the repository at this point in the history
Mongo Storage HHVM Compability
  • Loading branch information
bshaffer committed Sep 10, 2015
2 parents 9b22a4c + 6d8fc0d commit df2986f
Showing 1 changed file with 37 additions and 42 deletions.
79 changes: 37 additions & 42 deletions src/OAuth2/Storage/Mongo.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,15 @@ public function setClientDetails($client_id, $client_secret = null, $redirect_ur
))
);
} else {
$this->collection('client_table')->insert(
array(
'client_id' => $client_id,
'client_secret' => $client_secret,
'redirect_uri' => $redirect_uri,
'grant_types' => $grant_types,
'scope' => $scope,
'user_id' => $user_id,
)
$client = array(
'client_id' => $client_id,
'client_secret' => $client_secret,
'redirect_uri' => $redirect_uri,
'grant_types' => $grant_types,
'scope' => $scope,
'user_id' => $user_id,
);
$this->collection('client_table')->insert($client);
}

return true;
Expand Down Expand Up @@ -147,15 +146,14 @@ public function setAccessToken($access_token, $client_id, $user_id, $expires, $s
))
);
} else {
$this->collection('access_token_table')->insert(
array(
'access_token' => $access_token,
'client_id' => $client_id,
'expires' => $expires,
'user_id' => $user_id,
'scope' => $scope
)
$token = array(
'access_token' => $access_token,
'client_id' => $client_id,
'expires' => $expires,
'user_id' => $user_id,
'scope' => $scope
);
$this->collection('access_token_table')->insert($token);
}

return true;
Expand Down Expand Up @@ -191,17 +189,16 @@ public function setAuthorizationCode($code, $client_id, $user_id, $redirect_uri,
))
);
} else {
$this->collection('code_table')->insert(
array(
'authorization_code' => $code,
'client_id' => $client_id,
'user_id' => $user_id,
'redirect_uri' => $redirect_uri,
'expires' => $expires,
'scope' => $scope,
'id_token' => $id_token,
)
$token = array(
'authorization_code' => $code,
'client_id' => $client_id,
'user_id' => $user_id,
'redirect_uri' => $redirect_uri,
'expires' => $expires,
'scope' => $scope,
'id_token' => $id_token,
);
$this->collection('code_table')->insert($token);
}

return true;
Expand Down Expand Up @@ -243,15 +240,14 @@ public function getRefreshToken($refresh_token)

public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, $scope = null)
{
$this->collection('refresh_token_table')->insert(
array(
'refresh_token' => $refresh_token,
'client_id' => $client_id,
'user_id' => $user_id,
'expires' => $expires,
'scope' => $scope
)
$token = array(
'refresh_token' => $refresh_token,
'client_id' => $client_id,
'user_id' => $user_id,
'expires' => $expires,
'scope' => $scope
);
$this->collection('refresh_token_table')->insert($token);

return true;
}
Expand Down Expand Up @@ -288,14 +284,13 @@ public function setUser($username, $password, $firstName = null, $lastName = nul
))
);
} else {
$this->collection('user_table')->insert(
array(
'username' => $username,
'password' => $password,
'first_name' => $firstName,
'last_name' => $lastName
)
$user = array(
'username' => $username,
'password' => $password,
'first_name' => $firstName,
'last_name' => $lastName
);
$this->collection('user_table')->insert($user);
}

return true;
Expand Down

0 comments on commit df2986f

Please sign in to comment.