From f1287f5bc5024e4c3d235374c37b2d203feda947 Mon Sep 17 00:00:00 2001 From: Yan Date: Sat, 8 Feb 2025 21:07:21 +0800 Subject: [PATCH] Backup LDAP setup for future use --- bruno/collection.bru | 8 ++++ bruno/findUsers.bru | 7 +++- conf/springboot.yml | 7 ++-- misc/ldapdb.ldif | 40 ++++++++++++++++++ readme.adoc | 91 ---------------------------------------- readme.md | 98 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 156 insertions(+), 95 deletions(-) create mode 100644 bruno/collection.bru create mode 100644 misc/ldapdb.ldif delete mode 100644 readme.adoc create mode 100644 readme.md diff --git a/bruno/collection.bru b/bruno/collection.bru new file mode 100644 index 0000000..81213d3 --- /dev/null +++ b/bruno/collection.bru @@ -0,0 +1,8 @@ +auth { + mode: basic +} + +auth:basic { + username: + password: +} diff --git a/bruno/findUsers.bru b/bruno/findUsers.bru index 0889674..be68a02 100644 --- a/bruno/findUsers.bru +++ b/bruno/findUsers.bru @@ -7,5 +7,10 @@ meta { get { url: http://localhost:9090/services/api/user body: none - auth: none + auth: basic +} + +auth:basic { + username: cxfrs + password: password } diff --git a/conf/springboot.yml b/conf/springboot.yml index 7c7b276..b8b829d 100644 --- a/conf/springboot.yml +++ b/conf/springboot.yml @@ -10,9 +10,10 @@ spring: broker-url: "tcp://localhost:61616" ldap: urls: ldap://localhost:10389 - base: dc=vidconnect,dc=cyou - username: cn=admin,dc=vidconnect,dc=cyou - password: xxx + base: dc=example,dc=com + username: uid=admin,ou=system + password: secret app: queue-name: "UserServiceQueue" + user-search-base: ou=users diff --git a/misc/ldapdb.ldif b/misc/ldapdb.ldif new file mode 100644 index 0000000..382d93c --- /dev/null +++ b/misc/ldapdb.ldif @@ -0,0 +1,40 @@ +version: 1 + +dn: uid=cxfrs,ou=users,dc=example,dc=com +objectClass: inetOrgPerson +objectClass: organizationalPerson +objectClass: person +objectClass: top +cn: CXFRS server +sn: CXFRS +uid: cxfrs +userPassword:: e1NTSEF9QXhLYjdpeVNuWEhYMTBGaGxzU0RoOFdzU0d1VnpWbzJIcGFTcHc9P + Q== + +dn: cn=backend,ou=groups,dc=example,dc=com +objectClass: groupOfNames +objectClass: top +cn: backend +member: cn=cxfrs,ou=users,dc=example,dc=com + +dn: ou=groups,dc=example,dc=com +objectclass: organizationalUnit +objectclass: top +ou: groups + +dn: ou=users,dc=example,dc=com +objectclass: organizationalUnit +objectclass: top +ou: users + +dn: cn=server,ou=groups,dc=example,dc=com +objectClass: groupOfNames +objectClass: top +cn: server +member: cn=cxfrs,ou=users,dc=example,dc=com + +dn: dc=example,dc=com +objectclass: domain +objectclass: top +dc: example + diff --git a/readme.adoc b/readme.adoc deleted file mode 100644 index fe81bd5..0000000 --- a/readme.adoc +++ /dev/null @@ -1,91 +0,0 @@ -== Spring Boot Example with Camel exposing REST services using Apache CXF - -=== Introduction - -This example illustrates how to use https://projects.spring.io/spring-boot/[Spring Boot] with http://camel.apache.org[Camel]. It provides a simple REST service that is created using https://cxf.apache.org/[Apache CXF]. - - -=== Build - -You can build this example using: - - $ mvn package - -=== Run - -You can run this example using: - - $ mvn spring-boot:run - -After the Spring Boot application is started, you can open the following URL in your web browser to access the list of services: http://localhost:8080/services/ including WADL definition - -You can also access the REST endpoint from the command line: - -List all the users -[source,text] ----- -$ curl http://localhost:8080/services/api/user -s | jq . ----- - -The command will produce the following output: - -[source,json] ----- -[ { - "id" : 1, - "name" : "John Coltrane" -}, { - "id" : 2, - "name" : "Miles Davis" -}, { - "id" : 3, - "name" : "Sonny Rollins" -} ] ----- - -Retrieve a specific user -[source,text] ----- -$ curl http://localhost:8080/services/api/user/1 -s | jq . ----- - -The command will produce the following output: - -[source,json] ----- -{ - "id": 1, - "name": "John Coltrane" -} ----- - -Insert/update user - -[source,text] ----- -$ curl -X PUT http://localhost:8080/services/api/user --data '{"id":4,"name":"Charlie Parker"}' -H 'Content-Type: application/json' -v ----- - -The http status code of the response will be https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml#http-status-codes-1[201] - -Moreover, the input user is validated according to the annotations on the link:src/main/java/org/apache/camel/example/springboot/cxf/User.java[User bean] - -[source,text] ----- -$ curl -X PUT http://localhost:8080/services/api/user --data '{"id":4,"name":"C"}' -H 'Content-Type: application/json' ----- - -will produce a validation error - - -The Spring Boot application can be stopped pressing `[CTRL] + [C]` in the shell. - -=== Help and contributions - -If you hit any problem using Camel or have some feedback, then please -https://camel.apache.org/community/support/[let us know]. - -We also love contributors, so -https://camel.apache.org/community/contributing/[get involved] :-) - -The Camel riders! \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..6fc8f2e --- /dev/null +++ b/readme.md @@ -0,0 +1,98 @@ +**Please start the following services before testing** + +1. ApacheDS Server 2.0.0.AM27 + +2. Apache ActiveMQ 6.1.5 + + +**Startup screens** + +1. ApacheDS Server 2.0.0.AM27 + +``` +C:\Users\XXX\apacheds-2.0.0.AM28-SNAPSHOT\bin>apacheds.bat default start +Starting ApacheDS instance 'default'... +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.DefaultAttribute] - ERR_13207_VALUE_ALREADY_EXISTS The value '1.3.6.1.4.1.42.2.27.8.5.1' already exists in the attribute (supportedControl) +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.DefaultAttribute] - ERR_13207_VALUE_ALREADY_EXISTS The value '1.2.840.113556.1.4.841' already exists in the attribute (supportedControl) +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.DefaultAttribute] - ERR_13207_VALUE_ALREADY_EXISTS The value '1.3.6.1.4.1.4203.1.9.1.2' already exists in the attribute (supportedControl) +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.DefaultAttribute] - ERR_13207_VALUE_ALREADY_EXISTS The value '1.2.840.113556.1.4.319' already exists in the attribute (supportedControl) +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.DefaultAttribute] - ERR_13207_VALUE_ALREADY_EXISTS The value '1.2.840.113556.1.4.528' already exists in the attribute (supportedControl) +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.api.ldap.model.entry.Value] - MSG_13202_AT_IS_NULL () +[20:22:19] WARN [org.apache.directory.server.core.DefaultDirectoryService] - You didn't change the admin password of directory service instance 'default'. Please update the admin password as soon as possible to prevent a possible security breach. + _ _ ____ ____ + / \ _ __ ___ ___| |__ ___| _ \/ ___| + / _ \ | '_ \ / _` |/ __| '_ \ / _ \ | | \___ \ + / ___ \| |_) | (_| | (__| | | | __/ |_| |___) | + /_/ \_\ .__/ \__,_|\___|_| |_|\___|____/|____/ + |_| + + +``` + +2. Apache ActiveMQ 6.1.5 + +``` +C:\Users\XXX\apache-activemq-6.1.5\bin>activemq start + +Warning: JAVA_HOME environment variable is not set. + +Java Runtime: Oracle Corporation 17.0.14 C:\Users\XXX\graalvm-jdk-17.0.14+8.1 + Heap sizes: current=1048576k free=1039360k max=1048576k + JVM args: -XX:ThreadPriorityPolicy=1 -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct -XX:-UnlockExperimentalVMOptions -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=C:\Users\XXX\apache-activemq-6.1.5\bin\..\conf\login.config -Dactivemq.classpath=C:\Users\XXX\apache-activemq-6.1.5\bin\..\conf;C:\Users\XXX\apache-activemq-6.1.5\bin\../conf;C:\Users\XXX\apache-activemq-6.1.5\bin\../conf; -Dactivemq.home=C:\Users\XXX\apache-activemq-6.1.5\bin\.. -Dactivemq.base=C:\Users\XXX\apache-activemq-6.1.5\bin\.. -Dactivemq.conf=C:\Users\XXX\apache-activemq-6.1.5\bin\..\conf -Dactivemq.data=C:\Users\XXX\apache-activemq-6.1.5\bin\..\data -Djolokia.conf=file:C:\\Users\\XXX\\apache-activemq-6.1.5\\bin\\..\\conf\\jolokia-access.xml -Djava.io.tmpdir=C:\Users\XXX\apache-activemq-6.1.5\bin\..\data\tmp +Extensions classpath: + [C:\Users\XXX\apache-activemq-6.1.5\bin\..\lib,C:\Users\XXX\apache-activemq-6.1.5\bin\..\lib\camel,C:\Users\XXX\apache-activemq-6.1.5\bin\..\lib\optional,C:\Users\XXX\apache-activemq-6.1.5\bin\..\lib\web,C:\Users\XXX\apache-activemq-6.1.5\bin\..\lib\extra] +ACTIVEMQ_HOME: C:\Users\XXX\apache-activemq-6.1.5\bin\.. +ACTIVEMQ_BASE: C:\Users\XXX\apache-activemq-6.1.5\bin\.. +ACTIVEMQ_CONF: C:\Users\XXX\apache-activemq-6.1.5\bin\..\conf +ACTIVEMQ_DATA: C:\Users\XXX\apache-activemq-6.1.5\bin\..\data +Loading message broker from: xbean:activemq.xml + INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\Users\XXX\apache-activemq-6.1.5\bin\..\data\kahadb] + INFO | Starting Persistence Adapter: KahaDBPersistenceAdapter[C:\Users\XXX\apache-activemq-6.1.5\bin\..\data\kahadb] + INFO | Starting KahaDBStore + INFO | Opening MessageDatabase + INFO | Page File: C:\Users\XXX\apache-activemq-6.1.5\bin\..\data\kahadb\db.data. Recovering pageFile free list due to prior unclean shutdown.. + INFO | KahaDB is version 7 + INFO | Page File: C:\Users\XXX\apache-activemq-6.1.5\bin\..\data\kahadb\db.data. Recovered pageFile free list of size: 0 + INFO | Starting Temp Data Store + INFO | PListStore:[C:\Users\XXX\apache-activemq-6.1.5\bin\..\data\localhost\tmp_storage] started + INFO | Starting Job Scheduler Store + INFO | Persistence Adapter successfully started + INFO | Apache ActiveMQ 6.1.5 (localhost, ID:DESKTOP-66E87L5-60208-1739018831814-0:1) is starting + INFO | Listening for connections at: tcp://DESKTOP-66E87L5:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 + INFO | Connector openwire started + INFO | Listening for connections at: amqp://DESKTOP-66E87L5:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 + INFO | Connector amqp started + INFO | Listening for connections at: stomp://DESKTOP-66E87L5:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600 + INFO | Connector stomp started + INFO | Listening for connections at: mqtt://DESKTOP-66E87L5:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600 + INFO | Connector mqtt started + INFO | Starting Jetty server + INFO | Creating Jetty connector + WARN | ServletContext@o.e.j.s.ServletContextHandler@33425811{/,null,STARTING} has uncovered HTTP methods for the following paths: [/] + INFO | Listening for connections at ws://DESKTOP-66E87L5:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600 + INFO | Connector ws started + INFO | Apache ActiveMQ 6.1.5 (localhost, ID:DESKTOP-66E87L5-60208-1739018831814-0:1) started + INFO | For help or more information please see: http://activemq.apache.org + INFO | ActiveMQ WebConsole available at http://127.0.0.1:8161/ + INFO | ActiveMQ Jolokia REST API available at http://127.0.0.1:8161/api/jolokia/ +``` + +**Setup** + +* Please see conf/springboot.yml for LDAP/ActiveMQ Address + +* For LDAP group and user setup, see misc/ldapdb.ldif + +