Skip to content

Commit aacb804

Browse files
[Security] Make impersonation_path() argument mandatory and add impersonation_url()
1 parent 58534b6 commit aacb804

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Impersonate/ImpersonateUrlGenerator.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,20 @@ public function __construct(RequestStack $requestStack, FirewallMap $firewallMap
3636
$this->firewallMap = $firewallMap;
3737
}
3838

39-
public function generateImpersonationPath(string $identifier = null): string
39+
public function generateImpersonationPath(string $identifier): string
4040
{
4141
return $this->buildPath(null, $identifier);
4242
}
4343

44+
public function generateImpersonationUrl(string $identifier): string
45+
{
46+
if (null === $request = $this->requestStack->getCurrentRequest()) {
47+
return '';
48+
}
49+
50+
return $request->getUriForPath($this->buildPath(null, $identifier));
51+
}
52+
4453
public function generateExitPath(string $targetUri = null): string
4554
{
4655
return $this->buildPath($targetUri);

0 commit comments

Comments
 (0)