Skip to content

Commit 019227d

Browse files
authored
Set restart url for authorize commands incase authprocs need to restart a login (#180)
1 parent 245534f commit 019227d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/Services/AuthenticationService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Exception;
1818
use Psr\Http\Message\ServerRequestInterface;
1919
use SimpleSAML\Auth\Simple;
20+
use SimpleSAML\Auth\State;
2021
use SimpleSAML\Error;
2122
use SimpleSAML\Module\oidc\ClaimTranslatorExtractor;
2223
use SimpleSAML\Module\oidc\Controller\LogoutController;
@@ -164,6 +165,8 @@ private function prepareStateArray(
164165
$state['Source'] = ['entityid' => $state['Oidc']['OpenIdProviderMetadata']['issuer']];
165166
$state['Destination'] = ['entityid' => $state['Oidc']['RelyingPartyMetadata']['id']];
166167

168+
$state[State::RESTART] = $request->getUri()->__toString();
169+
167170
return $state;
168171
}
169172

spec/Services/AuthenticationServiceSpec.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
namespace spec\SimpleSAML\Module\oidc\Services;
1616

1717
use Laminas\Diactoros\ServerRequest;
18+
use Laminas\Diactoros\Uri;
1819
use PhpSpec\ObjectBehavior;
1920
use Prophecy\Argument;
2021
use SimpleSAML\Auth\Simple;
@@ -56,6 +57,10 @@ class AuthenticationServiceSpec extends ObjectBehavior
5657
],
5758
];
5859

60+
public static $uri = 'https://some-server/authorize.php?abc=efg';
61+
62+
63+
5964
/**
6065
* @param ServerRequest $request
6166
* @param ClientEntity $clientEntity
@@ -81,6 +86,7 @@ public function let(
8186
ClaimTranslatorExtractor $claimTranslatorExtractor
8287
): void {
8388
$request->getQueryParams()->willReturn(self::AUTHZ_REQUEST_PARAMS);
89+
$request->getUri()->willReturn(new Uri(self::$uri));
8490
$clientEntity->getAuthSourceId()->willReturn(self::AUTH_SOURCE);
8591
$clientEntity->toArray()->willReturn(self::CLIENT_ENTITY);
8692
$clientRepository->findById(self::CLIENT_ENTITY['id'])->willReturn($clientEntity);

0 commit comments

Comments
 (0)