forked from timander/fitnesse-ldap-authenticator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created simple authentication mechanism for FitNesse as a start towar…
…ds an authentication plugin for LDAP
- Loading branch information
Showing
5 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
*.iml | ||
*.ipr | ||
*.iws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This is a plugin for FitNesse to use LDAP Authentication. | ||
|
||
To use: | ||
|
||
1. Add the ldap-authentation-${version}.jar to the lib folder of your FitNesse server | ||
|
||
2. Add the following line to your plugins.properties | ||
Authenticator=fitnesse.authentication.LDAPAuthenticator | ||
|
||
3. Start the FitNesse server with | ||
java -cp "lib/ldap-authentation-${version}.jar:fitnesse.jar" fitnesseMain.FitNesseMain [optional args] | ||
(NOTE Windows users should use ; for the classpath seperator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.fitnesse</groupId> | ||
<artifactId>fitnesse-ldap-authenticator</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>FitNesse LDAP Authenticator</name> | ||
<url>http://fitnesse.org</url> | ||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>3.8.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.fitnesse</groupId> | ||
<artifactId>fitnesse</artifactId> | ||
<version>20090709</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
17 changes: 17 additions & 0 deletions
17
src/main/java/fitnesse/authentication/LDAPAuthenticator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package fitnesse.authentication; | ||
|
||
import java.util.Properties; | ||
|
||
public class LDAPAuthenticator extends Authenticator { | ||
|
||
public LDAPAuthenticator(Properties properties) { | ||
} | ||
|
||
@Override | ||
public boolean isAuthenticated(String username, String password) throws Exception { | ||
if (username == null || password == null) { | ||
return false; | ||
} | ||
return username.equals(password); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/fitnesse/authentication/LDAPAuthenticatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package fitnesse.authentication; | ||
|
||
import junit.framework.TestCase; | ||
|
||
|
||
public class LDAPAuthenticatorTest extends TestCase { | ||
|
||
public void testNullUsername() throws Exception { | ||
LDAPAuthenticator authenticator = new LDAPAuthenticator(null); | ||
assertFalse(authenticator.isAuthenticated(null, "password")); | ||
} | ||
|
||
public void testNullPassword() throws Exception { | ||
LDAPAuthenticator authenticator = new LDAPAuthenticator(null); | ||
assertFalse(authenticator.isAuthenticated("username", null)); | ||
} | ||
|
||
public void testNullUsernameAndPassword() throws Exception { | ||
LDAPAuthenticator authenticator = new LDAPAuthenticator(null); | ||
assertFalse(authenticator.isAuthenticated(null, null)); | ||
} | ||
|
||
public void testAuthenticated() throws Exception { | ||
LDAPAuthenticator authenticator = new LDAPAuthenticator(null); | ||
assertTrue(authenticator.isAuthenticated("same", "same")); | ||
} | ||
|
||
} |