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

org.infinispan.server.configuration.security.SecurityConfigurationBuilder Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev03
Show newest version
package org.infinispan.server.configuration.security;

import java.util.Arrays;

import org.infinispan.commons.configuration.Builder;
import org.infinispan.commons.configuration.Combine;
import org.infinispan.commons.configuration.attributes.AttributeSet;
import org.infinispan.server.configuration.ServerConfigurationBuilder;

/**
 * @since 10.0
 */
public class SecurityConfigurationBuilder implements Builder {
   private final CredentialStoresConfigurationBuilder credentialStoresConfiguration;
   private final RealmsConfigurationBuilder realmsConfiguration = new RealmsConfigurationBuilder();
   private final ServerConfigurationBuilder builder;

   public SecurityConfigurationBuilder(ServerConfigurationBuilder builder) {
      this.builder = builder;
      this.credentialStoresConfiguration = new CredentialStoresConfigurationBuilder(builder);
   }

   @Override
   public AttributeSet attributes() {
      return AttributeSet.EMPTY;
   }

   public CredentialStoresConfigurationBuilder credentialStores() {
      return credentialStoresConfiguration;
   }

   public RealmsConfigurationBuilder realms() {
      return realmsConfiguration;
   }

   @Override
   public void validate() {
      Arrays.asList(credentialStoresConfiguration, realmsConfiguration).forEach(Builder::validate);
   }

   @Override
   public SecurityConfiguration create() {
      return new SecurityConfiguration(credentialStoresConfiguration.create(), realmsConfiguration.create(), builder.properties());
   }

   @Override
   public SecurityConfigurationBuilder read(SecurityConfiguration template, Combine combine) {
      credentialStoresConfiguration.read(template.credentialStores(), combine);
      realmsConfiguration.read(template.realms(), combine);
      return this;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy