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

ec.gob.senescyt.sniese.commons.bundles.audit.AuditoriaBundle Maven / Gradle / Ivy

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

import ec.gob.senescyt.sniese.commons.configurations.ConfiguracionSnieseBase;
import ec.gob.senescyt.sniese.commons.security.PrincipalProvider;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;

public class AuditoriaBundle implements ConfiguredBundle {
    private PrincipalProvider principalProvider;

    public AuditoriaBundle(PrincipalProvider principalProvider) {
        this.principalProvider = principalProvider;
    }

    @Override
    public void run(T configuration, Environment environment) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        Class clazz = Class.forName(configuration.getConfiguracionSegura().getConfiguracionAuditoria().getWriterClass());
        AuditoriaWriter auditoriaWriter = (AuditoriaWriter) clazz.newInstance();
        environment.jersey().register(new AuditoriaMethodDispatcherAdapter(principalProvider, auditoriaWriter));
        environment.jersey().getResourceConfig().getContainerRequestFilters().add(new DireccionRemotaFilter());
    }

    @Override
    public void initialize(Bootstrap bootstrap) {
        // Do nothing
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy