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

prompto.security.auth.source.PasswordIsUserNameAuthenticationSourceFactory Maven / Gradle / Ivy

The newest version!
package prompto.security.auth.source;

import com.esotericsoftware.yamlbeans.YamlException;
import com.esotericsoftware.yamlbeans.document.YamlMapping;

import prompto.config.IConfigurationReader;
import prompto.config.auth.source.AuthenticationSourceConfiguration;
import prompto.config.auth.source.IAuthenticationSourceConfiguration;
import prompto.security.auth.JettyLoginModuleBase;

public class PasswordIsUserNameAuthenticationSourceFactory implements IAuthenticationSourceFactory {

	IAuthenticationSourceConfiguration config;
	
	@Override
	public IAuthenticationSourceConfiguration newConfiguration(IConfigurationReader reader) {
		return new AuthenticationSourceConfiguration(reader);
	}

	@Override
	public void setConfiguration(IAuthenticationSourceConfiguration config) {
		this.config = config;
	}

	@Override
	public String installJettyLoginModule() {
		String moduleName = getJettyLoginModuleName();
		JettyLoginModuleBase.install(moduleName, config);
		return moduleName;
	}
	
	@Override
	public String getJettyLoginModuleName() {
		return PasswordIsUserNameAuthenticationSource.class.getName();
	}
	
	@Override
	public IAuthenticationSource newAuthenticationSource() {
		return new PasswordIsUserNameAuthenticationSource();
	}
	
	@Override
	public YamlMapping toYaml() throws YamlException {
		YamlMapping yaml = new YamlMapping();
		yaml.setEntry("factory", PasswordIsUserNameAuthenticationSourceFactory.class.getName());
		return yaml;
	}
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy