示例#1
0
 function evt__version()
 {
     $url = toba_http::get_protocolo() . toba_http::get_nombre_servidor() . toba_rest::url_rest() . '/';
     $opciones = array('to' => $url);
     $cliente = toba::servicio_web_rest('rest_localhost', $opciones);
     $resp = $cliente->guzzle()->get('personas');
     if (!$resp->hasHeader('API-Version')) {
         toba::notificacion()->agregar('El header correspondiente a la version de la API no existe');
         return;
     }
     $version = $cliente->get_version_api($resp);
     toba::notificacion()->agregar('Version de la API rest: ' . $version->__toString(), 'info');
 }
示例#2
0
 protected function generar_url($params)
 {
     $url = toba_http::get_url_actual(false, true);
     $query_string = array();
     foreach ($params as $key => $valor) {
         if (isset($valor) && trim($valor) != '') {
             $query_string[] = urlencode($key) . '=' . urlencode($valor);
         }
     }
     if (!empty($query_string)) {
         $url .= '?' . implode('&', $query_string);
     }
     return $url;
 }
示例#3
0
 /**
  * Punto de entrada http al nucleo
  */
 function acceso_web()
 {
     try {
         $this->iniciar_contexto_ejecucion();
         toba::manejador_sesiones()->verificar_cambio_perfil_activo();
         //Miro si se quiere cambiar el perfil funcional activo
         $this->verificar_pedido_post();
         toba_http::headers_standart();
         try {
             $this->solicitud = $this->cargar_solicitud_web();
             $this->solicitud_en_proceso = true;
             $this->solicitud->procesar();
         } catch (toba_reset_nucleo $e) {
             toba::logger()->info('Se recargo el nucleo', 'toba');
             //El item retrasa el envio de headers?
             if (!$this->solicitud->get_datos_item('retrasar_headers')) {
                 throw new toba_error_def('ERROR: La operación no esta habilitada para provocar redirecciones.');
             }
             //TRAP para forzar la recarga de solicitud
             $this->solicitud_en_proceso = false;
             toba::memoria()->limpiar_memoria();
             $item_nuevo = $e->get_item();
             toba::memoria()->set_item_solicitado($item_nuevo);
             $this->solicitud = $this->cargar_solicitud_web();
             $this->solicitud->procesar();
         }
         $this->solicitud->registrar();
         $this->solicitud->finalizar_objetos();
         $this->finalizar_contexto_ejecucion();
     } catch (Exception $e) {
         toba::logger()->crit($e, 'toba');
         echo $e->getMessage() . "\n\n";
     }
     //toba::logger()->debug('Tiempo utilizado: ' . toba::cronometro()->tiempo_acumulado() . ' seg.');
     toba::logger()->guardar();
 }
示例#4
0
 private function envio_archivo($archivo, $mime_type)
 {
     if (file_exists($archivo)) {
         $long = filesize($archivo);
         $handler = fopen($archivo, 'r');
         toba_http::headers_download($mime_type, basename($archivo), $long);
         fpassthru($handler);
         fclose($handler);
     }
 }
示例#5
0
 protected function cabecera_http($longitud)
 {
     toba_http::headers_download($this->tipo_descarga, $this->nombre_archivo, $longitud);
 }
示例#6
0
 function servicio__download_certificado()
 {
     toba::memoria()->desactivar_reciclado();
     $nombre = 'publica.crt';
     $mime_type = 'application/pkix-cert';
     //Aca tengo que enviar los headers para el archivo y hacer el passthrough
     $proyecto = $this->get_modelo_proyecto();
     $archivo = toba_modelo_servicio_web::path_clave_publica($proyecto);
     if (file_exists($archivo)) {
         $long = filesize($archivo);
         $handler = fopen($archivo, 'r');
         toba_http::headers_download($mime_type, $nombre, $long);
         fpassthru($handler);
         fclose($handler);
     }
 }
示例#7
0
 function generar_link_confirmacion($usuario, $random)
 {
     $proto = toba_http::get_protocolo();
     $servidor = toba_http::get_nombre_servidor();
     $path = toba::proyecto()->get_www();
     $opciones = array('param_html' => array('tipo' => 'normal', 'texto' => 'Click Aqui'), 'prefijo' => $proto . $servidor . $path['url']);
     $parametros = array('usuario' => $usuario, 'randr' => $random);
     return toba::vinculador()->get_url(null, null, $parametros, $opciones);
 }
 protected function iniciar_pedido($url = null)
 {
     global $_POIDSY;
     $opcionales = array();
     $requeridos = array();
     foreach ($this->campos as $nombre => $opciones) {
         if ($opciones['requerido']) {
             $requeridos[] = $nombre;
         } else {
             $opcionales[] = $nombre;
         }
     }
     if (!empty($opcionales)) {
         // Request some information from the identity provider. Note that providers
         // don't have to implement the extension that provides this, so you can't
         // rely on getting results back.
         define('OPENID_SREG_OPTIONAL', implode(',', $opcionales));
     }
     if (isset($url)) {
         define('OPENID_URL', $url);
     }
     require toba_dir() . '/php/3ros/poidsy/sreg.ext.php';
     require toba_dir() . '/php/3ros/poidsy/ax.ext.php';
     foreach ($requeridos as $campo) {
         $atributo = $this->campos[$campo]['atributo'];
         AttributeExchange::addRequiredType($campo, constant("AttributeExchange::{$atributo}"));
     }
     foreach ($opcionales as $campo) {
         $atributo = $this->campos[$campo]['atributo'];
         AttributeExchange::addOptionalType($campo, constant("AttributeExchange::{$atributo}"));
     }
     $res = toba_http::get_url_actual();
     $p = toba::proyecto()->get_www();
     if (isset($p['url']) && trim($p['url']) != '') {
         $res .= '/' . $p['url'];
     }
     define('OPENID_RETURN_URL', $res . '/');
     require toba_dir() . '/php/3ros/poidsy/processor.php';
 }
示例#9
0
 function get_url_solicitud()
 {
     if (isset($this->url_original)) {
         return $this->url_original;
     } else {
         $url = toba_http::get_url_actual(true, true);
         $this->set_url_original($url);
     }
     return $this->url_original;
 }
示例#10
0
 function get_url_base_actual()
 {
     $url = toba_http::get_url_actual();
     return $url;
 }
示例#11
0
 static function url_api_doc()
 {
     return toba_http::get_protocolo() . toba_http::get_nombre_servidor() . self::url_rest() . '/api-docs';
 }
 protected function get_sp_config()
 {
     //Arma el entityID en base a una URL fija de toba
     $entityID = toba_http::get_protocolo() . toba_http::get_nombre_servidor();
     $entityID .= toba::instancia()->get_url_proyecto($this->proyecto_login);
     $info = array('entityId' => $entityID . '/default-sp', 'assertionConsumerService' => array('url' => $entityID . '?acs'), 'singleLogoutService' => array('url' => $entityID . '?sls'), 'NameIDFormat' => $this->atributo_usuario);
     return $info;
 }