Complete authentication return pubkey
This commit is contained in:
parent
0c91860454
commit
af1f125866
@ -35,7 +35,29 @@ class SQRLController extends Controller
|
||||
{
|
||||
// Validate the nonce if it has been given.
|
||||
if ($request->get('nut')) {
|
||||
Log::debug(sprintf('Got a NUT [%s]',$request->get('nut')));
|
||||
|
||||
//Get the user by the original nonce
|
||||
$o = SQRLAuth\Nonce::check($request->get('nut'),'orig_nonce');
|
||||
Log::debug(sprintf('User [%s]',serialize($o->getAttributes())));
|
||||
|
||||
if ($o && $o->verified) {
|
||||
if ($o->pubkey && ! $o->pubkey->disabled)
|
||||
// For JSON we just need the SQRL login
|
||||
return $request->expectsJson() ? $o->pubkey->public_key : $o->pubkey;
|
||||
|
||||
else
|
||||
return response()->json([
|
||||
'isReady'=>FALSE,
|
||||
'msg'=>'Not Verified'
|
||||
],404);
|
||||
|
||||
} else {
|
||||
return response()->json([
|
||||
'isReady'=>FALSE,
|
||||
'msg'=>'Not Ready'
|
||||
],404);
|
||||
}
|
||||
}
|
||||
|
||||
// If this laravel, check if the user has been logged in
|
||||
@ -100,11 +122,12 @@ class SQRLController extends Controller
|
||||
} else {
|
||||
foreach (['ver','cmd'] as $y)
|
||||
Log::debug(sprintf('API-client-%s [%s]',str_pad($y,5,' '),Arr::get($decode_request,'client.'.$y)));
|
||||
|
||||
Log::debug(sprintf('API-client-opt [%s]',join('|',Arr::get($decode_request,'client.opt',[]))));
|
||||
Log::debug(sprintf('API-client-idk [%s]',base64_encode(Arr::get($decode_request,'client.idk'))));
|
||||
Log::debug(sprintf('API-server [%s]',serialize(Arr::get($decode_request,'server'))));
|
||||
|
||||
Log::debug(sprintf('API-type [%s]',$sqrl_nonce->type));
|
||||
Log::debug(sprintf('API-type [%s]',$sqrl_nonce->type));
|
||||
|
||||
switch ($sqrl_nonce->type) {
|
||||
case 'auth':
|
||||
|
Loading…
Reference in New Issue
Block a user