All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ec.gob.senescyt.sniese.commons.clients.ServicioAutenticacionCliente Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package ec.gob.senescyt.sniese.commons.clients;

import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import ec.gob.senescyt.sniese.commons.security.PrincipalProvider;

public class ServicioAutenticacionCliente extends AbstractServicioCliente {

    private static final String URL_VALIDAR_TOKEN = "token/validar";
    private static final String ENCABEZADO_TOKEN = "x-token";

    public ServicioAutenticacionCliente(ServicioFactory factory, PrincipalProvider principalProvider) {
        super(factory, principalProvider);
    }

    public String obtenerNombreUsuarioPorToken(String token) {
        WebResource.Builder solicitud = construirSolicitud(URL_VALIDAR_TOKEN, null);
        WebResource.Builder builder = solicitud.header(ENCABEZADO_TOKEN, token);
        return builder.get(ClientResponse.class).getEntity(String.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy