Skip to content

Commit

Permalink
Merge branch 'release/v3.1.7' into support/v3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
enfoqueNativo committed Feb 13, 2019
2 parents bfc92b6 + e70699b commit 34b1de8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

[CURRENT](https://github.com/SIU-Toba/framework/compare/master...develop)

[3.1.7](https://github.com/SIU-Toba/framework/releases/tag/v3.1.7) (2019-02-13)
- Se mejora la autoconfiguración de apis rest via arai-cli (merge @develop)
- Se pospone la carga del archivo de claves de arai (merge @develop)

[3.1.6](https://github.com/SIU-Toba/framework/releases/tag/v3.1.6) (2019-01-15)
- Modifica el hook de Toba para Registry, remueve codigo no necesario (merge @develop)
- Modifica toba_version quitando la opcion pre-alpha y agregando la opcion dev (merge @develop)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.6
3.1.7
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "siu-toba-framework",
"version": "3.1.6",
"version": "3.1.7",
"description": "Framework para desarrollo rápido de aplicaciones web",
"license": "SEE LICENSE IN licencia.txt",
"repository": "https://github.com/SIU-Toba/framework.git",
Expand Down
47 changes: 30 additions & 17 deletions src/SIUToba/Arai/RegistryHooksProyectoToba.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class RegistryHooksProyectoToba implements HooksInterface
*/
protected $instalacion;

protected $araiSyncKey;

function __construct()
{
$this->inicializarEntorno();
Expand Down Expand Up @@ -250,9 +248,9 @@ protected function postConsumeSamlIdp(Consumption $feature)

$endpoint = $provider->getEndpoint();
if ($endpoint == '') {
echo "no posee configurado 'endpoint'\n";
return;
}
echo "no posee configurado 'endpoint'\n";
return;
}
$iniInstalacion = new \toba_ini($this->instalacion->archivo_info_basica());

$iniInstalacion->agregar_entrada("autenticacion", "saml_onelogin");
Expand Down Expand Up @@ -316,7 +314,7 @@ protected function preProvideApi(Provision $feature)
$options['auth']['type'] = $iniServer->get_datos_entrada("autenticacion");
}

$publicKey = $this->getAraiSyncKeyPublic();
$publicKey = $this->getAraiSyncKeyPublic();
$options['auth']['credentials']['cert'] = $publicKey;

$endpoint = $this->getProyectoUrl();
Expand Down Expand Up @@ -391,9 +389,9 @@ protected function getProyectoUrl()
$archivo = $this->instalacion->get_instancia($this->getInstanciaId())->get_dir()."/instancia.ini";
throw new \Exception("Es necesario especificar la URL completa del sistema en el atributo 'full_url' de la seccion [$proyecto] del archivo $archivo");
}
if (substr($fullUrl, -1) == '/') {
$fullUrl = substr($fullUrl, 0, -1);
}
if (substr($fullUrl, -1) == '/') {
$fullUrl = substr($fullUrl, 0, -1);
}
return $fullUrl;
}

Expand All @@ -403,8 +401,6 @@ protected function getProyectoUrl()
protected function inicializarEntorno()
{
$this->instalacion = $this->cargarToba();

$this->araiSyncKey = $this->cargarAraiSyncKey();
}

/**
Expand Down Expand Up @@ -444,12 +440,14 @@ protected function cargarAraiSyncKey()

protected function getAraiSyncKeyPublic()
{
return AraiCli::getCryptoService()->getPublicFromSyncKey($this->araiSyncKey);
$araiSyncKey = $this->cargarAraiSyncKey();
return AraiCli::getCryptoService()->getPublicFromSyncKey($araiSyncKey);
}

protected function getAraiSyncKeyPrivate()
{
return AraiCli::getCryptoService()->getPrivateFromSyncKey($this->araiSyncKey);
$araiSyncKey = $this->cargarAraiSyncKey();
return AraiCli::getCryptoService()->getPrivateFromSyncKey($araiSyncKey);
}

/**
Expand Down Expand Up @@ -538,6 +536,7 @@ protected function getCredencialesClienteSimple($auth)
{
echo "Procesando cliente con usuario '{$auth['credentials']['user']}':";
if (!isset($auth['credentials']['cert'])) {
echo " sin clave pública\n";
return;
}

Expand All @@ -556,7 +555,8 @@ protected function getCredencialesClienteSimple($auth)
echo " {$e->getMessage()}\n";
}

if (!$decryptedCredentials){
if (!$decryptedCredentials) {
echo " no se pudo desencriptar la clave\n";
return;
}

Expand All @@ -582,13 +582,25 @@ protected function actualizarClienteIni($provider, $acceso)
if (!$iniCliente->existe_entrada("conexion")) {
echo "el cliente de la api '$apiId' no esta correctamente configurado (no posee la entrada conexion)\n";
return;
}
}

$datos = $iniCliente->get_datos_entrada('conexion');

$datos['to'] = $provider->getEndpoint();

$datos['auth_tipo'] = $provider->getOptions()['auth']['type'];
$posibles = explode(',' , $provider->getOptions()['auth']['type']);
if (count($posibles) > 1) {
if (! isset($datos['auth_tipo'])) {
$datos['auth_tipo'] = current($posibles); //Defaultea en el primero porque se desconocen las capacidades del cliente
} elseif (! in_array($datos['auth_tipo'], $posibles)) {
echo 'El servidor no provee el mecanismo de autenticación "' . $datos['auth_tipo'] . '"' . PHP_EOL;
return;
} elseif (in_array($datos['auth_tipo'], array('basic', 'digest')) && in_array('digest', $posibles)) {
$datos['auth_tipo'] = 'digest'; //Si usa uno de los basicos y esta disponible, poner el menos peorcito
}
} else {
$datos['auth_tipo'] = current($posibles); //Defaultea en el unico metodo provisto por el server (BC)
}

$iniCliente->agregar_entrada("conexion", $datos);
$iniCliente->guardar();
Expand Down Expand Up @@ -621,11 +633,12 @@ protected function configurarCliente($feature, $opciones)

$authType = $authCliente['auth_tipo'];

$credentials = [];
if (in_array($authType, array('basic', 'digest'))){
$credentials = $this->configurarClienteSimple($feature, $authServer, $authCliente);
}

if ($credentials){
if ( ! empty($credentials)) {
$feature->addAuth($authType, $credentials);
}
}
Expand Down

0 comments on commit 34b1de8

Please sign in to comment.