$request = Request::
create('/login/verify?user=weaverryan&hash=thehash'
);
$linker =
$this->
createLinker();
$linker->
consumeLoginLink($request);
} private function createSignatureHash(string
$username, int
$expires, array
$extraFields =
['emailProperty' => 'ryan@symfonycasts.com', 'passwordProperty' => 'pwhash'
]): string
{ $hasher =
new SignatureHasher($this->propertyAccessor,
array_keys($extraFields), 's3cret'
);
$user =
new TestLoginLinkHandlerUser($username,
$extraFields['emailProperty'
] ?? '',
$extraFields['passwordProperty'
] ?? '',
$extraFields['lastAuthenticatedAt'
] ?? null
);
return $hasher->
computeSignatureHash($user,
$expires);
} private function createLinker(array
$options =
[], array
$extraProperties =
['emailProperty', 'passwordProperty'
]): LoginLinkHandler
{ $options =
array_merge([ 'lifetime' => 600,
'route_name' => 'app_check_login_link_route',
],
$options);
return new LoginLinkHandler($this->router,
$this->userProvider,
new SignatureHasher($this->propertyAccessor,
$extraProperties, 's3cret',
$this->expiredLinkStorage,
$options['max_uses'
] ?? null
),
$options);
}}