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

io.smallrye.config.SecretKeysConfigSourceInterceptor Maven / Gradle / Ivy

package io.smallrye.config;

import java.util.Set;

import javax.annotation.Priority;

@Priority(Priorities.LIBRARY + 100)
public class SecretKeysConfigSourceInterceptor implements ConfigSourceInterceptor {
    private static final long serialVersionUID = 7291982039729980590L;

    private final Set secrets;

    public SecretKeysConfigSourceInterceptor(final Set secrets) {
        this.secrets = secrets;
    }

    @Override
    public ConfigValue getValue(final ConfigSourceInterceptorContext context, final String name) {
        if (SecretKeys.isLocked() && isSecret(name)) {
            throw ConfigMessages.msg.notAllowed(name);
        }
        return context.proceed(name);
    }

    private boolean isSecret(final String name) {
        return secrets.contains(name);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy