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

org.wildfly.swarm.config.management.SecurityRealm Maven / Gradle / Ivy

package org.wildfly.swarm.config.management;

import org.wildfly.swarm.config.runtime.AttributeDocumentation;
import org.wildfly.swarm.config.runtime.ResourceDocumentation;
import org.wildfly.swarm.config.runtime.SingletonResource;
import org.wildfly.swarm.config.runtime.Address;
import org.wildfly.swarm.config.runtime.ResourceType;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener;
import java.util.List;
import org.wildfly.swarm.config.runtime.Subresource;
import org.wildfly.swarm.config.management.security_realm.PlugInConsumer;
import org.wildfly.swarm.config.management.security_realm.PlugInSupplier;
import org.wildfly.swarm.config.management.security_realm.PlugIn;
import org.wildfly.swarm.config.runtime.SubresourceInfo;
import org.wildfly.swarm.config.management.security_realm.TruststoreAuthentication;
import org.wildfly.swarm.config.management.security_realm.TruststoreAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.TruststoreAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.LdapAuthorization;
import org.wildfly.swarm.config.management.security_realm.LdapAuthorizationConsumer;
import org.wildfly.swarm.config.management.security_realm.LdapAuthorizationSupplier;
import org.wildfly.swarm.config.management.security_realm.KerberosAuthentication;
import org.wildfly.swarm.config.management.security_realm.KerberosAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.KerberosAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.UsersAuthentication;
import org.wildfly.swarm.config.management.security_realm.UsersAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.UsersAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.LdapAuthentication;
import org.wildfly.swarm.config.management.security_realm.LdapAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.LdapAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.JaasAuthentication;
import org.wildfly.swarm.config.management.security_realm.JaasAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.JaasAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.SecretServerIdentity;
import org.wildfly.swarm.config.management.security_realm.SecretServerIdentityConsumer;
import org.wildfly.swarm.config.management.security_realm.SecretServerIdentitySupplier;
import org.wildfly.swarm.config.management.security_realm.SslServerIdentity;
import org.wildfly.swarm.config.management.security_realm.SslServerIdentityConsumer;
import org.wildfly.swarm.config.management.security_realm.SslServerIdentitySupplier;
import org.wildfly.swarm.config.management.security_realm.PlugInAuthorization;
import org.wildfly.swarm.config.management.security_realm.PlugInAuthorizationConsumer;
import org.wildfly.swarm.config.management.security_realm.PlugInAuthorizationSupplier;
import org.wildfly.swarm.config.management.security_realm.PropertiesAuthentication;
import org.wildfly.swarm.config.management.security_realm.PropertiesAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.PropertiesAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.KerberosServerIdentity;
import org.wildfly.swarm.config.management.security_realm.KerberosServerIdentityConsumer;
import org.wildfly.swarm.config.management.security_realm.KerberosServerIdentitySupplier;
import org.wildfly.swarm.config.management.security_realm.PlugInAuthentication;
import org.wildfly.swarm.config.management.security_realm.PlugInAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.PlugInAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.LocalAuthentication;
import org.wildfly.swarm.config.management.security_realm.LocalAuthenticationConsumer;
import org.wildfly.swarm.config.management.security_realm.LocalAuthenticationSupplier;
import org.wildfly.swarm.config.management.security_realm.PropertiesAuthorization;
import org.wildfly.swarm.config.management.security_realm.PropertiesAuthorizationConsumer;
import org.wildfly.swarm.config.management.security_realm.PropertiesAuthorizationSupplier;
import org.wildfly.swarm.config.runtime.ModelNodeBinding;

/**
 * A security realm that can be associated with a management interface and used
 * to control access to the management services.
 */
@Address("/core-service=management/security-realm=*")
@ResourceType("security-realm")
public class SecurityRealm>
		implements
			org.wildfly.swarm.config.runtime.Keyed {

	private String key;
	private PropertyChangeSupport pcs;
	private SecurityRealmResources subresources = new SecurityRealmResources();
	@AttributeDocumentation("After a users group membership has been loaded should a 1:1 relationship be assumed regarding group to role mapping.")
	private Boolean mapGroupsToRoles;

	public SecurityRealm(java.lang.String key) {
		super();
		this.key = key;
	}

	public String getKey() {
		return this.key;
	}

	/**
	 * Adds a property change listener
	 */
	public void addPropertyChangeListener(PropertyChangeListener listener) {
		if (null == this.pcs)
			this.pcs = new PropertyChangeSupport(this);
		this.pcs.addPropertyChangeListener(listener);
	}

	/**
	 * Removes a property change listener
	 */
	public void removePropertyChangeListener(
			java.beans.PropertyChangeListener listener) {
		if (this.pcs != null)
			this.pcs.removePropertyChangeListener(listener);
	}

	public SecurityRealmResources subresources() {
		return this.subresources;
	}

	/**
	 * Add all PlugIn objects to this subresource
	 * 
	 * @return this
	 * @param value
	 *            List of PlugIn objects.
	 */
	@SuppressWarnings("unchecked")
	public T plugIns(java.util.List value) {
		this.subresources.plugIns = value;
		return (T) this;
	}

	/**
	 * Add the PlugIn object to the list of subresources
	 * 
	 * @param value
	 *            The PlugIn to add
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public T plugIn(PlugIn value) {
		this.subresources.plugIns.add(value);
		return (T) this;
	}

	/**
	 * Create and configure a PlugIn object to the list of subresources
	 * 
	 * @param key
	 *            The key for the PlugIn resource
	 * @param config
	 *            The PlugInConsumer to use
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public T plugIn(java.lang.String childKey, PlugInConsumer consumer) {
		PlugIn child = new PlugIn<>(childKey);
		if (consumer != null) {
			consumer.accept(child);
		}
		plugIn(child);
		return (T) this;
	}

	/**
	 * Create and configure a PlugIn object to the list of subresources
	 * 
	 * @param key
	 *            The key for the PlugIn resource
	 * @return this
	 */
	@SuppressWarnings("unchecked")
	public T plugIn(java.lang.String childKey) {
		plugIn(childKey, null);
		return (T) this;
	}

	/**
	 * Install a supplied PlugIn object to the list of subresources
	 */
	@SuppressWarnings("unchecked")
	public T plugIn(PlugInSupplier supplier) {
		plugIn(supplier.get());
		return (T) this;
	}

	/**
	 * Configuration of a keystore to use to create a trust manager to verify
	 * clients.
	 */
	@SuppressWarnings("unchecked")
	public T truststoreAuthentication(TruststoreAuthentication value) {
		this.subresources.truststoreAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration of a keystore to use to create a trust manager to verify
	 * clients.
	 */
	@SuppressWarnings("unchecked")
	public T truststoreAuthentication(TruststoreAuthenticationConsumer consumer) {
		TruststoreAuthentication child = new TruststoreAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.truststoreAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration of a keystore to use to create a trust manager to verify
	 * clients.
	 */
	@SuppressWarnings("unchecked")
	public T truststoreAuthentication() {
		TruststoreAuthentication child = new TruststoreAuthentication<>();
		this.subresources.truststoreAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration of a keystore to use to create a trust manager to verify
	 * clients.
	 */
	@SuppressWarnings("unchecked")
	public T truststoreAuthentication(TruststoreAuthenticationSupplier supplier) {
		this.subresources.truststoreAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthorization(LdapAuthorization value) {
		this.subresources.ldapAuthorization = value;
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthorization(LdapAuthorizationConsumer consumer) {
		LdapAuthorization child = new LdapAuthorization<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.ldapAuthorization = child;
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthorization() {
		LdapAuthorization child = new LdapAuthorization<>();
		this.subresources.ldapAuthorization = child;
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthorization(LdapAuthorizationSupplier supplier) {
		this.subresources.ldapAuthorization = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration to use Kerberos to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosAuthentication(KerberosAuthentication value) {
		this.subresources.kerberosAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration to use Kerberos to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosAuthentication(KerberosAuthenticationConsumer consumer) {
		KerberosAuthentication child = new KerberosAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.kerberosAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use Kerberos to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosAuthentication() {
		KerberosAuthentication child = new KerberosAuthentication<>();
		this.subresources.kerberosAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use Kerberos to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosAuthentication(KerberosAuthenticationSupplier supplier) {
		this.subresources.kerberosAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored directly within the
	 * standalone.xml or host.xml configuration file as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T usersAuthentication(UsersAuthentication value) {
		this.subresources.usersAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored directly within the
	 * standalone.xml or host.xml configuration file as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T usersAuthentication(UsersAuthenticationConsumer consumer) {
		UsersAuthentication child = new UsersAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.usersAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored directly within the
	 * standalone.xml or host.xml configuration file as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T usersAuthentication() {
		UsersAuthentication child = new UsersAuthentication<>();
		this.subresources.usersAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored directly within the
	 * standalone.xml or host.xml configuration file as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T usersAuthentication(UsersAuthenticationSupplier supplier) {
		this.subresources.usersAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthentication(LdapAuthentication value) {
		this.subresources.ldapAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthentication(LdapAuthenticationConsumer consumer) {
		LdapAuthentication child = new LdapAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.ldapAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthentication() {
		LdapAuthentication child = new LdapAuthentication<>();
		this.subresources.ldapAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use LDAP as the user repository.
	 */
	@SuppressWarnings("unchecked")
	public T ldapAuthentication(LdapAuthenticationSupplier supplier) {
		this.subresources.ldapAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration to use a JAAS LoginContext to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T jaasAuthentication(JaasAuthentication value) {
		this.subresources.jaasAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration to use a JAAS LoginContext to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T jaasAuthentication(JaasAuthenticationConsumer consumer) {
		JaasAuthentication child = new JaasAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.jaasAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use a JAAS LoginContext to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T jaasAuthentication() {
		JaasAuthentication child = new JaasAuthentication<>();
		this.subresources.jaasAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use a JAAS LoginContext to authenticate the users.
	 */
	@SuppressWarnings("unchecked")
	public T jaasAuthentication(JaasAuthenticationSupplier supplier) {
		this.subresources.jaasAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration of the secret/password-based identity of a server or host
	 * controller.
	 */
	@SuppressWarnings("unchecked")
	public T secretServerIdentity(SecretServerIdentity value) {
		this.subresources.secretServerIdentity = value;
		return (T) this;
	}

	/**
	 * Configuration of the secret/password-based identity of a server or host
	 * controller.
	 */
	@SuppressWarnings("unchecked")
	public T secretServerIdentity(SecretServerIdentityConsumer consumer) {
		SecretServerIdentity child = new SecretServerIdentity<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.secretServerIdentity = child;
		return (T) this;
	}

	/**
	 * Configuration of the secret/password-based identity of a server or host
	 * controller.
	 */
	@SuppressWarnings("unchecked")
	public T secretServerIdentity() {
		SecretServerIdentity child = new SecretServerIdentity<>();
		this.subresources.secretServerIdentity = child;
		return (T) this;
	}

	/**
	 * Configuration of the secret/password-based identity of a server or host
	 * controller.
	 */
	@SuppressWarnings("unchecked")
	public T secretServerIdentity(SecretServerIdentitySupplier supplier) {
		this.subresources.secretServerIdentity = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration of the SSL identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T sslServerIdentity(SslServerIdentity value) {
		this.subresources.sslServerIdentity = value;
		return (T) this;
	}

	/**
	 * Configuration of the SSL identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T sslServerIdentity(SslServerIdentityConsumer consumer) {
		SslServerIdentity child = new SslServerIdentity<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.sslServerIdentity = child;
		return (T) this;
	}

	/**
	 * Configuration of the SSL identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T sslServerIdentity() {
		SslServerIdentity child = new SslServerIdentity<>();
		this.subresources.sslServerIdentity = child;
		return (T) this;
	}

	/**
	 * Configuration of the SSL identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T sslServerIdentity(SslServerIdentitySupplier supplier) {
		this.subresources.sslServerIdentity = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthorization(PlugInAuthorization value) {
		this.subresources.plugInAuthorization = value;
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthorization(PlugInAuthorizationConsumer consumer) {
		PlugInAuthorization child = new PlugInAuthorization<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.plugInAuthorization = child;
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthorization() {
		PlugInAuthorization child = new PlugInAuthorization<>();
		this.subresources.plugInAuthorization = child;
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthorization(PlugInAuthorizationSupplier supplier) {
		this.subresources.plugInAuthorization = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored within a properties file as the
	 * user repository. The entries within the properties file are
	 * username={credentials} with each user being specified on it's own line.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthentication(PropertiesAuthentication value) {
		this.subresources.propertiesAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored within a properties file as the
	 * user repository. The entries within the properties file are
	 * username={credentials} with each user being specified on it's own line.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthentication(PropertiesAuthenticationConsumer consumer) {
		PropertiesAuthentication child = new PropertiesAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.propertiesAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored within a properties file as the
	 * user repository. The entries within the properties file are
	 * username={credentials} with each user being specified on it's own line.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthentication() {
		PropertiesAuthentication child = new PropertiesAuthentication<>();
		this.subresources.propertiesAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration to use a list users stored within a properties file as the
	 * user repository. The entries within the properties file are
	 * username={credentials} with each user being specified on it's own line.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthentication(PropertiesAuthenticationSupplier supplier) {
		this.subresources.propertiesAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration for the Kerberos identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosServerIdentity(KerberosServerIdentity value) {
		this.subresources.kerberosServerIdentity = value;
		return (T) this;
	}

	/**
	 * Configuration for the Kerberos identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosServerIdentity(KerberosServerIdentityConsumer consumer) {
		KerberosServerIdentity child = new KerberosServerIdentity<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.kerberosServerIdentity = child;
		return (T) this;
	}

	/**
	 * Configuration for the Kerberos identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosServerIdentity() {
		KerberosServerIdentity child = new KerberosServerIdentity<>();
		this.subresources.kerberosServerIdentity = child;
		return (T) this;
	}

	/**
	 * Configuration for the Kerberos identity of a server or host controller.
	 */
	@SuppressWarnings("unchecked")
	public T kerberosServerIdentity(KerberosServerIdentitySupplier supplier) {
		this.subresources.kerberosServerIdentity = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthentication(PlugInAuthentication value) {
		this.subresources.plugInAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthentication(PlugInAuthenticationConsumer consumer) {
		PlugInAuthentication child = new PlugInAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.plugInAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthentication() {
		PlugInAuthentication child = new PlugInAuthentication<>();
		this.subresources.plugInAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration of a user store plug-in for use by the realm.
	 */
	@SuppressWarnings("unchecked")
	public T plugInAuthentication(PlugInAuthenticationSupplier supplier) {
		this.subresources.plugInAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration of the local authentication mechanism.
	 */
	@SuppressWarnings("unchecked")
	public T localAuthentication(LocalAuthentication value) {
		this.subresources.localAuthentication = value;
		return (T) this;
	}

	/**
	 * Configuration of the local authentication mechanism.
	 */
	@SuppressWarnings("unchecked")
	public T localAuthentication(LocalAuthenticationConsumer consumer) {
		LocalAuthentication child = new LocalAuthentication<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.localAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration of the local authentication mechanism.
	 */
	@SuppressWarnings("unchecked")
	public T localAuthentication() {
		LocalAuthentication child = new LocalAuthentication<>();
		this.subresources.localAuthentication = child;
		return (T) this;
	}

	/**
	 * Configuration of the local authentication mechanism.
	 */
	@SuppressWarnings("unchecked")
	public T localAuthentication(LocalAuthenticationSupplier supplier) {
		this.subresources.localAuthentication = supplier.get();
		return (T) this;
	}

	/**
	 * Configuration to use properties file to load a users roles. The entries
	 * within the properties file are username={roles} where roles is a comma
	 * separated list of users roles.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthorization(PropertiesAuthorization value) {
		this.subresources.propertiesAuthorization = value;
		return (T) this;
	}

	/**
	 * Configuration to use properties file to load a users roles. The entries
	 * within the properties file are username={roles} where roles is a comma
	 * separated list of users roles.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthorization(PropertiesAuthorizationConsumer consumer) {
		PropertiesAuthorization child = new PropertiesAuthorization<>();
		if (consumer != null) {
			consumer.accept(child);
		}
		this.subresources.propertiesAuthorization = child;
		return (T) this;
	}

	/**
	 * Configuration to use properties file to load a users roles. The entries
	 * within the properties file are username={roles} where roles is a comma
	 * separated list of users roles.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthorization() {
		PropertiesAuthorization child = new PropertiesAuthorization<>();
		this.subresources.propertiesAuthorization = child;
		return (T) this;
	}

	/**
	 * Configuration to use properties file to load a users roles. The entries
	 * within the properties file are username={roles} where roles is a comma
	 * separated list of users roles.
	 */
	@SuppressWarnings("unchecked")
	public T propertiesAuthorization(PropertiesAuthorizationSupplier supplier) {
		this.subresources.propertiesAuthorization = supplier.get();
		return (T) this;
	}

	/**
	 * Child mutators for SecurityRealm
	 */
	public static class SecurityRealmResources {
		/**
		 * An extension to the security realm allowing additional authentication
		 * / authorization modules to be loaded.
		 */
		@ResourceDocumentation("An extension to the security realm allowing additional authentication / authorization modules to be loaded.")
		@SubresourceInfo("plugIn")
		private List plugIns = new java.util.ArrayList<>();
		@SingletonResource
		@ResourceDocumentation("Configuration of a keystore to use to create a trust manager to verify clients.")
		private TruststoreAuthentication truststoreAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration to use LDAP as the user repository.")
		private LdapAuthorization ldapAuthorization;
		@SingletonResource
		@ResourceDocumentation("Configuration to use Kerberos to authenticate the users.")
		private KerberosAuthentication kerberosAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration to use a list users stored directly within the standalone.xml or host.xml configuration file as the user repository.")
		private UsersAuthentication usersAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration to use LDAP as the user repository.")
		private LdapAuthentication ldapAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration to use a JAAS LoginContext to authenticate the users.")
		private JaasAuthentication jaasAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration of the secret/password-based identity of a server or host controller.")
		private SecretServerIdentity secretServerIdentity;
		@SingletonResource
		@ResourceDocumentation("Configuration of the SSL identity of a server or host controller.")
		private SslServerIdentity sslServerIdentity;
		@SingletonResource
		@ResourceDocumentation("Configuration of a user store plug-in for use by the realm.")
		private PlugInAuthorization plugInAuthorization;
		@SingletonResource
		@ResourceDocumentation("Configuration to use a list users stored within a properties file as the user repository. The entries within the properties file are username={credentials} with each user being specified on it's own line.")
		private PropertiesAuthentication propertiesAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration for the Kerberos identity of a server or host controller.")
		private KerberosServerIdentity kerberosServerIdentity;
		@SingletonResource
		@ResourceDocumentation("Configuration of a user store plug-in for use by the realm.")
		private PlugInAuthentication plugInAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration of the local authentication mechanism.")
		private LocalAuthentication localAuthentication;
		@SingletonResource
		@ResourceDocumentation("Configuration to use properties file to load a users roles. The entries within the properties file are username={roles} where roles is a comma separated list of users roles.")
		private PropertiesAuthorization propertiesAuthorization;

		/**
		 * Get the list of PlugIn resources
		 * 
		 * @return the list of resources
		 */
		@Subresource
		public List plugIns() {
			return this.plugIns;
		}

		public PlugIn plugIn(java.lang.String key) {
			return this.plugIns.stream().filter(e -> e.getKey().equals(key))
					.findFirst().orElse(null);
		}
		/**
		 * Configuration of a keystore to use to create a trust manager to
		 * verify clients.
		 */
		@Subresource
		public TruststoreAuthentication truststoreAuthentication() {
			return this.truststoreAuthentication;
		}

		/**
		 * Configuration to use LDAP as the user repository.
		 */
		@Subresource
		public LdapAuthorization ldapAuthorization() {
			return this.ldapAuthorization;
		}

		/**
		 * Configuration to use Kerberos to authenticate the users.
		 */
		@Subresource
		public KerberosAuthentication kerberosAuthentication() {
			return this.kerberosAuthentication;
		}

		/**
		 * Configuration to use a list users stored directly within the
		 * standalone.xml or host.xml configuration file as the user repository.
		 */
		@Subresource
		public UsersAuthentication usersAuthentication() {
			return this.usersAuthentication;
		}

		/**
		 * Configuration to use LDAP as the user repository.
		 */
		@Subresource
		public LdapAuthentication ldapAuthentication() {
			return this.ldapAuthentication;
		}

		/**
		 * Configuration to use a JAAS LoginContext to authenticate the users.
		 */
		@Subresource
		public JaasAuthentication jaasAuthentication() {
			return this.jaasAuthentication;
		}

		/**
		 * Configuration of the secret/password-based identity of a server or
		 * host controller.
		 */
		@Subresource
		public SecretServerIdentity secretServerIdentity() {
			return this.secretServerIdentity;
		}

		/**
		 * Configuration of the SSL identity of a server or host controller.
		 */
		@Subresource
		public SslServerIdentity sslServerIdentity() {
			return this.sslServerIdentity;
		}

		/**
		 * Configuration of a user store plug-in for use by the realm.
		 */
		@Subresource
		public PlugInAuthorization plugInAuthorization() {
			return this.plugInAuthorization;
		}

		/**
		 * Configuration to use a list users stored within a properties file as
		 * the user repository. The entries within the properties file are
		 * username={credentials} with each user being specified on it's own
		 * line.
		 */
		@Subresource
		public PropertiesAuthentication propertiesAuthentication() {
			return this.propertiesAuthentication;
		}

		/**
		 * Configuration for the Kerberos identity of a server or host
		 * controller.
		 */
		@Subresource
		public KerberosServerIdentity kerberosServerIdentity() {
			return this.kerberosServerIdentity;
		}

		/**
		 * Configuration of a user store plug-in for use by the realm.
		 */
		@Subresource
		public PlugInAuthentication plugInAuthentication() {
			return this.plugInAuthentication;
		}

		/**
		 * Configuration of the local authentication mechanism.
		 */
		@Subresource
		public LocalAuthentication localAuthentication() {
			return this.localAuthentication;
		}

		/**
		 * Configuration to use properties file to load a users roles. The
		 * entries within the properties file are username={roles} where roles
		 * is a comma separated list of users roles.
		 */
		@Subresource
		public PropertiesAuthorization propertiesAuthorization() {
			return this.propertiesAuthorization;
		}
	}

	/**
	 * After a users group membership has been loaded should a 1:1 relationship
	 * be assumed regarding group to role mapping.
	 */
	@ModelNodeBinding(detypedName = "map-groups-to-roles")
	public Boolean mapGroupsToRoles() {
		return this.mapGroupsToRoles;
	}

	/**
	 * After a users group membership has been loaded should a 1:1 relationship
	 * be assumed regarding group to role mapping.
	 */
	@SuppressWarnings("unchecked")
	public T mapGroupsToRoles(java.lang.Boolean value) {
		Object oldValue = this.mapGroupsToRoles;
		this.mapGroupsToRoles = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("mapGroupsToRoles", oldValue, value);
		return (T) this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy