<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
use \Slim\Middleware\HttpBasicAuthentication\AuthenticatorInterface;
/**
* Description of Api
*
* @author lmontoya
*/
class Autenticacion implements AuthenticatorInterface {
public function __invoke(array $arguments) {
$user = $arguments["user"];
$password = $arguments["password"];
if(!empty($user) and !empty($password)):
$user = Usuarios::deApiPorUserPass($user, $password);
if (isset($user) and ! empty($user)):
$usuarioCompleto = Usuarios::datosCompletosApi($user->usuarioID);
if (!empty($usuarioCompleto)) :
return true;
endif;
endif;
endif;
return false;
}
}