/** * @covers Mozu\Api\Security\Authentication::getAccessToken * @todo Implement testGetAccessToken(). */ public function testCustomerLogin() { try { $userAuthInfo = new CustomerUserAuthInfo(); $userAuthInfo->username = $this->customerUserName; $userAuthInfo->password = $this->customerPassword; $authenticationProfile = CustomerAuthenticator::authenticate($userAuthInfo, $this->tenantId, $this->siteId); $this->assertNotNull($authenticationProfile->authTicket); $this->assertNotNull($authenticationProfile->customerAccount); } catch (Exception $e) { parent::printError($e); $this->fail($e->getMessage()); } }
private function setUserAuth() { $newTicket = null; $authTicket = $this->apiContext->getUserAuthTicket(); if ($authTicket->authenticationScope == AuthenticationScope::CUSTOMER) { $newTicket = CustomerAuthenticator::ensureAuthTicket($authTicket); } else { $newTicket = UserAuthenticator::ensureAuthTicket($authTicket); } if ($newTicket != null) { $authTicket = $newTicket->authTicket; } $this->withHeader(Headers::X_VOL_USER_CLAIMS, $authTicket->accessToken); $this->apiContext->setUserAuthTicket($authTicket); return $this; }