2017-09-20 40 views
0

Je suis en train de configurer un serveur de superposition CAS WAR pour tester https://apereo.github.io/cas/5.1.x/index.htmlConfiguration serveur LDAP intégré Spring dans le CAS Guerre Overlay serveur

Je veux démarrer un serveur intégré LDAP Spring avec ceci:

@Configuration 
@EnableWebSecurity(debug = true) 
public class SecurityConfig extends WebSecurityConfigurerAdapter { 

    @Override 
    public void configure(final AuthenticationManagerBuilder auth) throws Exception { 
     auth 
       .ldapAuthentication() 
       .userSearchBase("") 
       .userSearchFilter("(uid={0})") 
       .groupSearchBase("ou=Groups") 
       .groupSearchFilter("(uniqueMember={0})") 
       .userDetailsContextMapper(new InetOrgPersonContextMapper()) 
       .contextSource(contextSource()) 
       .passwordCompare() 
        .passwordAttribute("telephoneNumber") 
     ; 
    } 

    @Bean 
    public DefaultSpringSecurityContextSource contextSource() { 
     return new DefaultSpringSecurityContextSource(
       Arrays.asList("ldap://localhost:" + LDAP_PORT + "/"), "dc=jbcpcalendar,dc=com"); 
    } 

} 

et ont la configuration suivante pour le fichier de configuration LDIF utiliser

~/serveur CAS// src/CAS main/resources/application.yml

spring: 
    ldap: 
    embedded: 
     ldif: classpath:/ldif/calendar.ldif 
     baseDn: dc=jbcpcalendar,dc=com 
     port: ${LDAP_PORT:33389} 
#  credential: 
#  username: user 
#  password: secret 

J'utilise le projet CAS Overlay Gradle War, et j'essaie seulement d'ajouter LDAP.

Quand j'ai ajouté le fichier de configuration ci-dessus (SecurityConfig.java) à ~/serveur CAS/AR/src/main/java/*

Quand j'ajoute ces dépendances:

subprojects { 

    dependencies { 

      compile "org.apereo.cas:cas-server-support-ldap:${project.'cas.version'}" 

     // LDAP: 
     // Not sure if I need and/or want this starter: 
     compile("org.springframework.boot:spring-boot-starter-data-ldap:${project.'springboot.version'}") 

     compile("org.springframework.ldap:spring-ldap-core:2.3.1.RELEASE") 
     compile("org.springframework.security:spring-security-ldap:4.2.3.RELEASE") 
     // Due to a artifact resolution issue with Gradle, 
     // spring-tx must be pulled in or Gradle will fetch an older one that doesn’t work. 
     compile("org.springframework:spring-tx") 
     compile("com.unboundid:unboundid-ldapsdk") 

     // Security: 
     compile("org.springframework.boot:spring-boot-starter-security") 
    } 

à ~/serveur CAS/build.gradle je reçois cette erreur:

06:16:37.706 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 
06:16:37.706 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred evaluating root project 'chapter10.00-cas-server'. 
06:16:37.706 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-data-ldap:1.5.3.RELEASE] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. 

Quand j'ajoute ces dépendances:

  compile "org.apereo.cas:cas-server-support-ldap:${project.'cas.version'}" 

     compile("org.springframework.boot:spring-boot-starter-web") 
     compile("org.codehaus.groovy:groovy") 

     // LDAP: 
     // Not sure if I need and/or want this starter: 
     compile("org.springframework.boot:spring-boot-starter-data-ldap") 

     compile("org.springframework.ldap:spring-ldap-core:2.3.1.RELEASE") 
     compile("org.springframework.security:spring-security-ldap:4.2.3.RELEASE") 
     // Due to a artifact resolution issue with Gradle, 
     // spring-tx must be pulled in or Gradle will fetch an older one that doesn’t work. 
     compile("org.springframework:spring-tx") 
     compile("com.unboundid:unboundid-ldapsdk") 


     // Security: 
     compile("org.springframework.boot:spring-boot-starter-security") 

à ~/serveur No.-CAS/AR/build.gradle je reçois cette erreur:

06:24:57.567 [QUIET] [system.out] 
    06:24:57.644 [QUIET] [system.out] __ ____  _  ____ __ 
    06:24:57.645 [QUIET] [system.out] ///___| /\ /___| \ \ 
    06:24:57.645 [QUIET] [system.out] | | | |  /_ \ \___ \ | | 
    06:24:57.645 [QUIET] [system.out] | | | |___ /___ \ ___) | | | 
    06:24:57.645 [QUIET] [system.out] | | \____| /_/ \_\ |____/ | | 
    06:24:57.645 [QUIET] [system.out] \_\       /_/ 
    06:24:57.645 [QUIET] [system.out] 
    06:24:57.645 [QUIET] [system.out] CAS Version: 5.1.2 
    06:24:57.645 [QUIET] [system.out] CAS Commit Id: fae163b426ba91cc78a18e3805b2f2fac9c03b2e 
    06:24:57.645 [QUIET] [system.out] CAS Build Date/Time: 2017-09-20T12:19:37Z 
    06:24:57.645 [QUIET] [system.out] Spring Boot Version: 1.5.3.RELEASE 
    06:24:57.645 [QUIET] [system.out] ------------------------------------------------------------ 
    06:24:57.645 [QUIET] [system.out] System Date/Time: 2017-09-20T06:24:57.372 
    06:24:57.645 [QUIET] [system.out] System Temp Directory: /var/folders/vm/nx7j7v8x4db1f4xsztj_rsmm0000gn/T/ 
    06:24:57.646 [QUIET] [system.out] ------------------------------------------------------------ 
    06:24:57.646 [QUIET] [system.out] Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre 
    06:24:57.646 [QUIET] [system.out] Java Vendor: Oracle Corporation 
    06:24:57.646 [QUIET] [system.out] Java Version: 1.8.0_144 
    06:24:57.646 [QUIET] [system.out] JCE Installed: no 
    06:24:57.646 [QUIET] [system.out] ------------------------------------------------------------ 
    06:24:57.646 [QUIET] [system.out] OS Architecture: x86_64 
    06:24:57.646 [QUIET] [system.out] OS Name: Mac OS X 
    06:24:57.646 [QUIET] [system.out] OS Version: 10.12.6 
    06:24:57.646 [QUIET] [system.out] ------------------------------------------------------------ 
    06:24:57.646 [QUIET] [system.out] Apache Tomcat Version: Apache Tomcat/8.5.20 
    06:24:57.646 [QUIET] [system.out] ------------------------------------------------------------ 
    06:24:57.646 [QUIET] [system.out] 
    06:24:57.646 [QUIET] [system.out] 
    06:24:57.833 [QUIET] [system.out] 2017-09-20 06:24:57.833 INFO 17183 --- [   main] .CasCoreBootstrapStandaloneConfiguration : Configuration files found at [/etc/cas/config] are [[/etc/cas/config/application.yml, /etc/cas/config/cas.properties]] 
    06:24:57.852 [QUIET] [system.out] 2017-09-20 06:24:57.852 INFO 17183 --- [   main] .CasCoreBootstrapStandaloneConfiguration : Found and loaded [14] setting(s) from [/etc/cas/config] 
    06:24:57.852 [QUIET] [system.out] 2017-09-20 06:24:57.852 INFO 17183 --- [   main] b.c.PropertySourceBootstrapConfiguration : Located property source: PropertiesPropertySource {name='standaloneCasConfigService'} 
    06:25:00.680 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running 
    06:25:00.681 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry. 
    06:25:00.681 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry. 
    06:25:00.681 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry. 
    06:25:00.681 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry. 
    06:25:00.681 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry. 
    06:25:00.682 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry. 
    06:25:01.171 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED 
    06:25:01.171 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] **Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'' finished with exit value 1 (state: FAILED)** 

Je ne l'ai pas vu docs parler de serveurs ldap embarqués, et je l'ai regardé: https://apereo.github.io/2017/03/24/cas51-ldapauthnjasypt-tutorial/ https://apereo.github.io/cas/development/installation/LDAP-Authentication.html

Mais certainement ne sais pas où case.properties est censé être placé, et en ajoutant à: ~/cas-server/src/main/resources/cas.properties

ni

~/cas-server/cas/src/main/resources/cas.properties

semble avoir un quelconque effet.

À part cela, je n'ai rien changé avec le téléchargement original du projet.

Je suis vraiment aux prises avec cela. Toute assistance sera grandement appréciée!

Répondre

0

Vous feriez mieux d'utiliser Docker pour cela. Mettre en place un fichier Docker-composer qui tourne simplement un serveur LDAP intégré et puis également un serveur CAS qui se connecte à l'LDAP.

Voici un exemple pour vous aider à démarrer: https://github.com/mmoayyed/dockerized-idp-testbed

Vous devez connecter le serveur avec cas-la ldap course et retirer de composer tous les autres composants.