prompto.config.auth.IAuthenticationConfiguration Maven / Gradle / Ivy
The newest version!
package prompto.config.auth;
import java.util.Arrays;
import java.util.Collection;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import com.esotericsoftware.yamlbeans.YamlException;
import com.esotericsoftware.yamlbeans.document.YamlMapping;
import prompto.config.auth.method.IAuthenticationMethodConfiguration;
import prompto.config.auth.source.IAuthenticationSourceConfiguration;
public interface IAuthenticationConfiguration {
IAuthenticationMethodConfiguration getAuthenticationMethodConfiguration();
IAuthenticationSourceConfiguration getAuthenticationSourceConfiguration();
Collection getWhiteList();
IAuthenticationConfiguration withAuthenticationMethodConfiguration(IAuthenticationMethodConfiguration config);
IAuthenticationConfiguration withAuthenticationSourceConfiguration(IAuthenticationSourceConfiguration config);
IAuthenticationConfiguration withWhiteList(Collection whiteList);
YamlMapping toYaml() throws YamlException;
public static class Inline implements IAuthenticationConfiguration {
Supplier authenticationMethodConfiguration = ()->null;
Supplier authenticationSourceConfiguration = ()->null;
Supplier> whiteList = ()->DEFAULT_WHITE_LIST;
@Override public IAuthenticationMethodConfiguration getAuthenticationMethodConfiguration() { return authenticationMethodConfiguration.get(); }
@Override public IAuthenticationSourceConfiguration getAuthenticationSourceConfiguration() { return authenticationSourceConfiguration.get(); }
@Override public Collection getWhiteList() { return whiteList.get(); }
@Override
public IAuthenticationConfiguration withAuthenticationMethodConfiguration(IAuthenticationMethodConfiguration config) {
authenticationMethodConfiguration = ()->config;
return this;
}
@Override
public IAuthenticationConfiguration withAuthenticationSourceConfiguration(IAuthenticationSourceConfiguration config) {
authenticationSourceConfiguration = ()->config;
return this;
}
@Override
public IAuthenticationConfiguration withWhiteList(Collection list) {
whiteList = ()->list;
return this;
}
@Override
public YamlMapping toYaml() throws YamlException {
return null;
}
}
static final Collection DEFAULT_WHITE_LIST = Arrays.asList( "jpg", "jpeg", "ico", "png", "tif", "tiff", "js", "map", "jsx", "css", "svg", "gif" )
.stream().map(s->"*." + s).collect(Collectors.toSet());
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy