001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.ldap.embedded; 018 019import java.util.ArrayList; 020import java.util.List; 021 022import org.springframework.boot.context.properties.ConfigurationProperties; 023import org.springframework.boot.convert.Delimiter; 024import org.springframework.core.io.Resource; 025 026/** 027 * Configuration properties for Embedded LDAP. 028 * 029 * @author EddĂș MelĂ©ndez 030 * @author Mathieu Ouellet 031 * @since 1.5.0 032 */ 033@ConfigurationProperties(prefix = "spring.ldap.embedded") 034public class EmbeddedLdapProperties { 035 036 /** 037 * Embedded LDAP port. 038 */ 039 private int port = 0; 040 041 /** 042 * Embedded LDAP credentials. 043 */ 044 private Credential credential = new Credential(); 045 046 /** 047 * List of base DNs. 048 */ 049 @Delimiter(Delimiter.NONE) 050 private List<String> baseDn = new ArrayList<>(); 051 052 /** 053 * Schema (LDIF) script resource reference. 054 */ 055 private String ldif = "classpath:schema.ldif"; 056 057 /** 058 * Schema validation. 059 */ 060 private Validation validation = new Validation(); 061 062 public int getPort() { 063 return this.port; 064 } 065 066 public void setPort(int port) { 067 this.port = port; 068 } 069 070 public Credential getCredential() { 071 return this.credential; 072 } 073 074 public void setCredential(Credential credential) { 075 this.credential = credential; 076 } 077 078 public List<String> getBaseDn() { 079 return this.baseDn; 080 } 081 082 public void setBaseDn(List<String> baseDn) { 083 this.baseDn = baseDn; 084 } 085 086 public String getLdif() { 087 return this.ldif; 088 } 089 090 public void setLdif(String ldif) { 091 this.ldif = ldif; 092 } 093 094 public Validation getValidation() { 095 return this.validation; 096 } 097 098 public static class Credential { 099 100 /** 101 * Embedded LDAP username. 102 */ 103 private String username; 104 105 /** 106 * Embedded LDAP password. 107 */ 108 private String password; 109 110 public String getUsername() { 111 return this.username; 112 } 113 114 public void setUsername(String username) { 115 this.username = username; 116 } 117 118 public String getPassword() { 119 return this.password; 120 } 121 122 public void setPassword(String password) { 123 this.password = password; 124 } 125 126 } 127 128 public static class Validation { 129 130 /** 131 * Whether to enable LDAP schema validation. 132 */ 133 private boolean enabled = true; 134 135 /** 136 * Path to the custom schema. 137 */ 138 private Resource schema; 139 140 public boolean isEnabled() { 141 return this.enabled; 142 } 143 144 public void setEnabled(boolean enabled) { 145 this.enabled = enabled; 146 } 147 148 public Resource getSchema() { 149 return this.schema; 150 } 151 152 public void setSchema(Resource schema) { 153 this.schema = schema; 154 } 155 156 } 157 158}