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

org.n3r.eql.dbfieldcryptor.refer.ReferSecretFieldsConfig Maven / Gradle / Ivy

There is a newer version: 0.1.19
Show newest version
package org.n3r.eql.dbfieldcryptor.refer;

import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import lombok.val;
import org.n3r.eql.dbfieldcryptor.EqlSecretFieldsConnectionProxy;
import org.n3r.eql.dbfieldcryptor.SecretFieldsConfigable;
import org.n3r.eql.util.S;

import java.util.Set;

public class ReferSecretFieldsConfig implements SecretFieldsConfigable {
    private Set secretFieldsConfig;

    public ReferSecretFieldsConfig() {
        val eqlConfig = EqlSecretFieldsConnectionProxy.threadLocal.get();
        if (eqlConfig == null) return;

        val secureDatabaseFields = eqlConfig.getStr("securetDatabaseFields.define");
        if (S.isBlank(secureDatabaseFields)) return;

        val splitter = Splitter.onPattern("\\s+").trimResults().omitEmptyStrings();
        Iterable secureFields = splitter.split(secureDatabaseFields.toUpperCase());

        secretFieldsConfig = Sets.newHashSet(secureFields);
    }

    @Override
    public Set getSecretFieldsConfig() {
        return secretFieldsConfig;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy