public function addUser(array $user) { $this->store->removeExpiredObjects(); if ($this->store->getObject($this->scopeIdentity('u', $user['id'])) === null) { $user['id'] = $this->scopeIdentity('u', $user['id']); return $this->store->addObject($user); } else { throw new SimpleSAML_Error_Error('oauth2server:DUPLICATE'); } }
public function addClient(array $client) { if (!array_key_exists($client['id'], $this->configuredClients)) { $this->store->removeExpiredObjects(); if ($this->registrationEnabled) { if (is_null($this->store->getObject($this->scopeIdentity('s', $client['id'])))) { $client['id'] = $this->scopeIdentity('s', $client['id']); return $this->store->addObject($client); } else { throw new SimpleSAML_Error_Error('oauth2server:DUPLICATE'); } } else { throw new SimpleSAML_Error_Error('oauth2server:REGISTRATION_DISABLED'); } } else { throw new SimpleSAML_Error_Error('oauth2server:DUPLICATE'); } }
public function addAccessToken(array $token) { $this->store->removeExpiredObjects(); if ($this->store->getObject($this->scopeIdentity('a', $token['id'])) === null) { $token['id'] = $this->scopeIdentity('a', $token['id']); return $this->store->addObject($token); } else { throw new SimpleSAML_Error_Error('oauth2server:DUPLICATE'); } }