Skip to content

Commit

Permalink
Rename api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
MishNajam committed Nov 3, 2023
1 parent 8600f16 commit b65424d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions service-api/app/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use App\Handler\LpasResourceHandler;
use App\Handler\LpasResourceImagesCollectionHandler;
use App\Handler\NotifyHandler;
use App\Handler\OneLoginAuthenticationCallbackHandler;
use App\Handler\OneLoginAuthenticationRequestHandler;
use App\Handler\RequestChangeEmailHandler;
use App\Handler\RequestCleanseHandler;
use App\Handler\RequestPasswordResetHandler;
Expand All @@ -29,8 +31,6 @@
use Mezzio\Application;
use Mezzio\MiddlewareFactory;
use Psr\Container\ContainerInterface;
use App\Handler\OneLoginAuthenticationRequestHandler;
use App\Handler\OneLoginAuthenticationCallbackHandler;

/**
* Setup routes with a single request method:
Expand Down Expand Up @@ -136,8 +136,8 @@

$app->patch('/v1/auth', AuthHandler::class, 'user.auth');

$app->get('/v1/auth-one-login', OneLoginAuthenticationRequestHandler::class, 'user.auth-one-login');
$app->get('/v1/auth-one-login-process', OneLoginAuthenticationCallbackHandler::class, 'user.auth-process');
$app->get('/v1/auth/start', OneLoginAuthenticationRequestHandler::class, 'user.auth-start');
$app->get('/v1/auth/callback', OneLoginAuthenticationCallbackHandler::class, 'user.auth-callback');

$app->post('/v1/email-user/{emailTemplate}', NotifyHandler::class, 'lpa.user.notify');
};
Original file line number Diff line number Diff line change
Expand Up @@ -1314,13 +1314,13 @@ public function iClickTheOneLoginButton(): void
*/
public function iAmRedirectedToTheRedirectPage(): void
{
$this->apiGet('/v1/auth-one-login-process', []);
$this->apiGet('/v1/auth/callback', []);

$this->ui->assertSession()->statusCodeEquals(StatusCodeInterface::STATUS_OK);

$response = $this->getResponseAsJson();

Assert::assertEquals('one-login-user', $response['Id']);
Assert::assertEquals('one-login-user@email.com', $response['Email']);
Assert::assertEquals('bf9e7e77-f283-49c6-a79c-65d5d309ef77', $response['Id']);
Assert::assertEquals('opg-use-an-lpa+test-user@digital.justice.gov.uk', $response['Email']);
}
}
2 changes: 1 addition & 1 deletion service-api/app/features/one-login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Feature: Authorise One Login
Scenario: I initiate authentication via one login
Given I am on the temporary one login page
When I click the one login button
Then I am redirected to the redirect page
Then I am redirected to the redirect page
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct(private ApiClient $apiClient)

public function authenticate(string $uiLocale, string $redirectUrl): ?array
{
return $this->apiClient->httpGet('/v1/auth-one-login', [
return $this->apiClient->httpGet('/v1/auth/start', [
'ui_locale' => $uiLocale,
'redirect_url' => $redirectUrl,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function can_get_authentication_request_uri(): void

$apiClientProphecy
->httpGet(
'/v1/auth-one-login',
'/v1/auth/start',
[
'ui_locale' => 'en',
'ui_locale' => 'en',
'redirect_url' => $redirect,
]
)->willReturn(['state' => $state, 'nonce' => $nonce, 'url' => $uri]);
Expand Down

0 comments on commit b65424d

Please sign in to comment.