コード例 #1
0
 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');
     }
 }
コード例 #2
0
 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');
     }
 }
コード例 #3
0
 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');
     }
 }