adding ldap test server
This commit is contained in:
parent
dff0175e83
commit
90221e9105
4
pom.xml
4
pom.xml
@ -92,6 +92,10 @@
|
|||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-ldap</artifactId>
|
<artifactId>spring-security-ldap</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.unboundid</groupId>
|
||||||
|
<artifactId>unboundid-ldapsdk</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
@ -39,7 +39,7 @@ public class SecurityConfig extends VaadinWebSecurity {
|
|||||||
@Bean
|
@Bean
|
||||||
public AuthenticationManager authenticationManager() {
|
public AuthenticationManager authenticationManager() {
|
||||||
DefaultSpringSecurityContextSource contextSource = new DefaultSpringSecurityContextSource(
|
DefaultSpringSecurityContextSource contextSource = new DefaultSpringSecurityContextSource(
|
||||||
"ldap://ldap.primefactorsolutions.com:389/dc=primefactorsolutions,dc=com");
|
"ldap://localhost:8389/dc=primefactorsolutions,dc=com");
|
||||||
contextSource.setCacheEnvironmentProperties(false);
|
contextSource.setCacheEnvironmentProperties(false);
|
||||||
LdapBindAuthenticationManagerFactory factory = new LdapBindAuthenticationManagerFactory(contextSource);
|
LdapBindAuthenticationManagerFactory factory = new LdapBindAuthenticationManagerFactory(contextSource);
|
||||||
factory.setUserDnPatterns("uid={0},ou=users");
|
factory.setUserDnPatterns("uid={0},ou=users");
|
||||||
|
@ -17,16 +17,25 @@ spring.mail.properties.mail.smtp.auth=true
|
|||||||
spring.mail.properties.mail.smtp.starttls.enable=true
|
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||||
spring.mail.properties.mail.smtp.starttls.required=true
|
spring.mail.properties.mail.smtp.starttls.required=true
|
||||||
|
|
||||||
|
spring.ldap.embedded.ldif=classpath:test-server.ldif
|
||||||
|
spring.ldap.embedded.base-dn=dc=primefactorsolutions,dc=com
|
||||||
|
spring.ldap.embedded.port=8389
|
||||||
|
|
||||||
# spring.datasource.url=jdbc:h2:mem:testdb
|
# spring.datasource.url=jdbc:h2:mem:testdb
|
||||||
# spring.datasource.url=jdbc:h2:file:./db
|
# spring.datasource.url=jdbc:h2:file:./db
|
||||||
# spring.datasource.url=jdbc:h2:file:/var/opt/pfs/db
|
# spring.datasource.url=jdbc:h2:file:/var/opt/pfs/db
|
||||||
spring.datasource.url=${DB_URL:jdbc:h2:mem:testdb}
|
spring.datasource.url=${DB_URL:jdbc:h2:mem:testdb}
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
|
||||||
spring.sql.init.mode=${SQL_INIT:embedded}
|
|
||||||
spring.datasource.driverClassName=org.h2.Driver
|
spring.datasource.driverClassName=org.h2.Driver
|
||||||
spring.datasource.username=sa
|
spring.datasource.username=sa
|
||||||
spring.datasource.password=${H2_PASS:sa}
|
spring.datasource.password=${H2_PASS:sa}
|
||||||
spring.h2.console.settings.web-allow-others=true
|
|
||||||
|
spring.jpa.show-sql=true
|
||||||
|
# spring.jpa.properties.hibernate.format_sql=true
|
||||||
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
||||||
spring.jpa.defer-datasource-initialization = true
|
spring.jpa.defer-datasource-initialization = true
|
||||||
|
|
||||||
|
spring.sql.init.mode=${SQL_INIT:embedded}
|
||||||
|
|
||||||
spring.h2.console.enabled=true
|
spring.h2.console.enabled=true
|
||||||
|
spring.h2.console.settings.web-allow-others=true
|
||||||
|
11
src/main/resources/logback.xml
Normal file
11
src/main/resources/logback.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
43
src/main/resources/test-server.ldif
Normal file
43
src/main/resources/test-server.ldif
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
dn: dc=primefactorsolutions,dc=com
|
||||||
|
objectclass: top
|
||||||
|
objectclass: domain
|
||||||
|
objectclass: extensibleObject
|
||||||
|
dc: primefactorsolutions
|
||||||
|
|
||||||
|
dn: ou=groups,dc=primefactorsolutions,dc=com
|
||||||
|
objectclass: top
|
||||||
|
objectclass: organizationalUnit
|
||||||
|
ou: groups
|
||||||
|
|
||||||
|
dn: ou=users,dc=primefactorsolutions,dc=com
|
||||||
|
objectclass: top
|
||||||
|
objectclass: organizationalUnit
|
||||||
|
ou: users
|
||||||
|
|
||||||
|
dn: uid=ben,ou=users,dc=primefactorsolutions,dc=com
|
||||||
|
objectclass: top
|
||||||
|
objectclass: person
|
||||||
|
objectclass: organizationalPerson
|
||||||
|
objectclass: inetOrgPerson
|
||||||
|
cn: Ben User
|
||||||
|
sn: BenUser
|
||||||
|
uid: ben
|
||||||
|
userPassword: $2a$10$c6bSeWPhg06xB1lvmaWNNe4NROmZiSpYhlocU/98HNr2MhIOiSt36
|
||||||
|
|
||||||
|
dn: uid=bob,ou=users,dc=primefactorsolutions,dc=com
|
||||||
|
objectclass: top
|
||||||
|
objectclass: person
|
||||||
|
objectclass: organizationalPerson
|
||||||
|
objectclass: inetOrgPerson
|
||||||
|
cn: Bob User
|
||||||
|
sn: BobUser
|
||||||
|
uid: bob
|
||||||
|
userPassword: bobspassword
|
||||||
|
|
||||||
|
dn: cn=employees,ou=groups,dc=primefactorsolutions,dc=com
|
||||||
|
objectclass: top
|
||||||
|
objectclass: groupOfUniqueNames
|
||||||
|
cn: employees
|
||||||
|
ou: groups
|
||||||
|
uniqueMember: uid=ben,ou=users,dc=primefactorsolutions,dc=com
|
||||||
|
uniqueMember: uid=bob,ou=users,dc=primefactorsolutions,dc=com
|
Loading…
Reference in New Issue
Block a user