Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth: set ldap base dn. Fix ldap docker example #1617

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker/examples/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_USER=odd-platform
POSTGRES_PASSWORD=odd-platform-password
POSTGRES_DATABASE=odd-platform
23 changes: 16 additions & 7 deletions docker/examples/ldap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,33 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DATABASE=${POSTGRES_DATABASE}
ports:
- 5432:5432
- "5432:5432"

odd-platform:
image: opendatadiscovery/odd-platform:latest
image: ghcr.io/opendatadiscovery/odd-platform:latest
restart: always
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://database:5432/${POSTGRES_DATABASE}
- SPRING_DATASOURCE_USERNAME=${POSTGRES_USER}
- SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
- AUTH_TYPE=LDAP
- SPRING_LDAP_URLS=ldap://ldap:10389
- SPRING_LDAP_DN_PATTERN=cn={0},ou=people,dc=planetexpress,dc=com
- AUTH_LDAP_URL=ldap://ldap:389
- AUTH_LDAP_PASSWORD=admin
- AUTH_LDAP_USERNAME=cn=admin,dc=example,dc=org
- AUTH_LDAP_DN_PATTERN=cn={0},ou=People
- AUTH_LDAP_BASE=dc=example,dc=org
depends_on:
- database
- ldap
ports:
- 8080:8080
- "8080:8080"


ldap:
image: rroemhild/test-openldap:latest
hostname: "ldap"
image: osixia/openldap:1.5.0
ports:
- "389:389"
- "636:636"
volumes:
- ./ldap/sample.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/sample.ldif
command: --copy-service
69 changes: 69 additions & 0 deletions docker/examples/ldap/sample.ldif
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# --- OUs -------------------------------------

dn: ou=Groups,dc=example,dc=org
objectClass: organizationalunit
objectClass: top
ou: Groups

dn: ou=People,dc=example,dc=org
objectClass: organizationalunit
objectClass: top
ou: People


# --- People ----------------------------------

dn: cn=marpontes,ou=People,dc=example,dc=org
objectClass: person
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: top
cn: marpontes
userpassword: pass
givenname: Marcello
sn: Pontes
mail: marcello@oncase.com.br
uid: 1001

dn: cn=zach,ou=People,dc=example,dc=org
objectClass: person
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: top
cn: zach
userpassword: pass
givenname: Zachary
sn: Zeus
mail: zach@oncase.com.br
uid: 1002

dn: cn=leonardo,ou=People,dc=example,dc=org
objectClass: person
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: top
cn: leonardo
userpassword: pass
givenname: Leonardo
sn: Luiz
mail: zach@oncase.com.br
uid: 1003


# --- Groups ----------------------------------

dn: cn=Administrator,ou=Groups,dc=example,dc=org
objectClass: groupofuniquenames
objectClass: top
ou: Groups
cn: Administrator
uniquemember: cn=marpontes, ou=People, dc=example,dc=org

dn: cn=Developers,ou=Groups,dc=example,dc=org
objectClass: groupofuniquenames
objectClass: top
ou: Groups
cn: Administrator
uniquemember: cn=marpontes, ou=People, dc=example,dc=org
uniquemember: cn=zach, ou=People, dc=example,dc=org
uniquemember: cn=leonardo, ou=People, dc=example,dc=org
2 changes: 1 addition & 1 deletion docker/examples/oauth2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- 5432:5432

odd-platform:
image: opendatadiscovery/odd-platform:latest
image: ghcr.io/opendatadiscovery/odd-platform:latest
restart: always
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://database:5432/${POSTGRES_DATABASE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class ODDLDAPProperties {
private String username;
private String password;
private String dnPattern;
private String base;
private UserFilter userFilter;
private Group groups;
private ActiveDirectory activeDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public LdapContextSource ldapContextSource() {
ctx.setUrl(properties.getUrl());
ctx.setUserDn(properties.getUsername());
ctx.setPassword(properties.getPassword());
ctx.setBase(properties.getBase());
return ctx;
}

Expand Down
1 change: 1 addition & 0 deletions odd-platform-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ auth:
# username:
# password:
# dn-pattern:
# base:
# user-filter:
# search-base:
# filter:
Expand Down
Loading