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

ApacheDS 2.0 #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.iml
target
dependency-reduced-pom.xml
work
log
497 changes: 497 additions & 0 deletions crowd-ldap-server.ipr

Large diffs are not rendered by default.

1,792 changes: 1,792 additions & 0 deletions crowd-ldap-server.iws

Large diffs are not rendered by default.

28 changes: 18 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j-version>1.6.6</slf4j-version>
<slf4j-version>1.7.21</slf4j-version>
</properties>

<dependencies>
Expand All @@ -30,19 +30,17 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-all</artifactId>
<version>1.5.7</version>
<exclusions>
<!-- shared-ldap-schema module needs to be excluded to avoid multiple schema resources on the classpath-->
<exclusion>
<groupId>org.apache.directory.shared</groupId>
<artifactId>shared-ldap-schema</artifactId>
</exclusion>
</exclusions>
<version>2.0.0-M21</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>crowd-integration-client-rest</artifactId>
<version>2.3.6</version>
<version>2.9.1</version>
</dependency>
</dependencies>

Expand All @@ -64,6 +62,16 @@
<artifactId>maven-shade-plugin</artifactId>
<version>1.7.1</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<!-- put your configurations here -->
<transformers>
<transformer
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
JAR=target/crowd-ldap-server-1.0.2-SNAPSHOT.jar
JAR=target/crowd-ldap-server-1.0.4-SNAPSHOT.jar

# Apache DS Settings
FIXADS="-Duser.language=en -Duser.country=US"
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/net/wimpi/crowd/ldap/CrowdAuthenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import com.atlassian.crowd.model.user.User;
import com.atlassian.crowd.service.client.CrowdClient;
import org.apache.directory.server.core.LdapPrincipal;
import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.LdapPrincipal;
import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.authn.AbstractAuthenticator;
import org.apache.directory.server.core.interceptor.context.BindOperationContext;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -24,14 +25,16 @@ public class CrowdAuthenticator extends AbstractAuthenticator {
ResourceBundle.getBundle("net.wimpi.crowd.ldap.strings");

private CrowdClient m_CrowdClient;
private DirectoryService service;

public CrowdAuthenticator(CrowdClient client) {
super("simple");
public CrowdAuthenticator(CrowdClient client, DirectoryService service) {
super(AuthenticationLevel.SIMPLE);
m_CrowdClient = client;
this.service = service;
}//constructor

public LdapPrincipal authenticate(BindOperationContext ctx) throws Exception {
String user = ctx.getDn().getRdn(2).getNormValue();
String user = ctx.getDn().getRdn(0).getNormValue();
String pass = new String(ctx.getCredentials(),"utf-8");

try {
Expand All @@ -41,7 +44,7 @@ public LdapPrincipal authenticate(BindOperationContext ctx) throws Exception {
throw new javax.naming.AuthenticationException("Invalid credentials for user: " + user);
} else {
log.debug(MessageFormat.format(c_ResourceBundle.getString("crowdauthenticator.user"), u.toString()));
return new LdapPrincipal(ctx.getDn(), AuthenticationLevel.SIMPLE);
return new LdapPrincipal(this.service.getSchemaManager(), ctx.getDn(), AuthenticationLevel.SIMPLE);
}
} catch (Exception ex) {
log.debug(c_ResourceBundle.getString("crowdauthenticator.authentication.failed") + "()::Authentication failed: " + ex );
Expand Down
Loading