public function tokens(Secret $secret) { $version = $this->getStableVersion(); if (!$version) { throw new ServiceNotFoundException('Stable version identity service is not found.'); } $auth = ['auth' => ['passwordCredentials' => ['username' => $secret->getUsername(), 'password' => $secret->getPassword()], 'tenantName' => $secret->getTenantName()]]; $json = json_encode($auth); $res = $this->getClient()->post($this->getUri([$version->getId(), 'tokens']), ['body' => $json]); $access = new Access(); $access->populate($res->getJson()); return $access; }
public function testSetter() { $s = new Secret(); $s->setUsername(TEST_API_USERNAME); $s->setPassword(TEST_API_PASSWORD); $s->setTenantName(TEST_API_TENANT_NAME); $s->setTenantId(TEST_API_TENANT_ID); $s->setAuthUrl(TEST_IDENTITY_ENDPOINT); $this->assertEquals(TEST_API_USERNAME, $s->getUsername()); $this->assertEquals(TEST_API_PASSWORD, $s->getPassword()); $this->assertEquals(TEST_API_TENANT_NAME, $s->getTenantName()); $this->assertEquals(TEST_API_TENANT_ID, $s->getTenantId()); $this->assertEquals(TEST_IDENTITY_ENDPOINT, $s->getAuthUrl()); }