Server IP : 184.154.167.98 / Your IP : 3.142.174.58 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/sesiones/3rdparty/php-opencloud/openstack/src/Identity/v2/ |
Upload File : |
<?php declare(strict_types=1); namespace OpenStack\Identity\v2; use GuzzleHttp\ClientInterface; use OpenStack\Common\Auth\IdentityService; use OpenStack\Common\Service\AbstractService; use OpenStack\Identity\v2\Models\Catalog; use OpenStack\Identity\v2\Models\Token; /** * Represents the OpenStack Identity v2 service. * * @property \OpenStack\Identity\v2\Api $api */ class Service extends AbstractService implements IdentityService { public static function factory(ClientInterface $client): self { return new static($client, new Api()); } public function authenticate(array $options = []): array { $definition = $this->api->postToken(); $response = $this->execute($definition, array_intersect_key($options, $definition['params'])); $token = $this->model(Token::class, $response); $serviceUrl = $this->model(Catalog::class, $response)->getServiceUrl( $options['catalogName'], $options['catalogType'], $options['region'], $options['urlType'] ); return [$token, $serviceUrl]; } /** * Generates a new authentication token. * * @param array $options {@see \OpenStack\Identity\v2\Api::postToken} * * @return Models\Token */ public function generateToken(array $options = []): Token { $response = $this->execute($this->api->postToken(), $options); return $this->model(Token::class, $response); } }