-
Notifications
You must be signed in to change notification settings - Fork 712
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
Authenticator plugin #1034
Comments
In our project Plugins is located next to FitnesseRoot and the fitnesse-standalone.jar. I believe you just drop the plugin in and restart the jar. |
Hi Ahennar,
I am not a Scala expert but
trait Authenticator
looks strange to me.
I think a trait can't be instantiated.
Must it not be
Class Authenticator?
Kind Regards
Six42
|
@JeremyCarlsten
@six42 package fitnesse.mod
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import fitnesse.authentication. { PasswordFile, PasswordCipher }
class MUAuthenticator(passwdFile: String) extends fitnesse.authentication.MultiUserAuthenticator(passwdFile) {
private val passwords = new PasswordFile(passwdFile);
private val users: Map[String, String] = passwords.getPasswordMap()
private val cipher: PasswordCipher = passwords.getCipher()
override def isAuthenticated(username: String, password: String): Boolean = {
if (username == null || password == null)
return false;
val foundPassword = users.get(username);
if (foundPassword == null)
return false;
val encryptedPassword = cipher.encrypt(password);
val ret = encryptedPassword.equals(foundPassword)
if (ret)
System.setProperty("AuthUser", username)
return ret;
}
} |
It seems to be looking for an init method in the MUAuthenticator class? perhaps compare your code to a working plugin like the hsac plugin? |
Hi Ahennar,
This is the expected behaviour according to the specification.
Look at the stacktrace which directs you to https://github.com/unclebob/fitnesse/blob/master/src/fitnesse/components/ComponentFactory.java
Here you find the cause of your problem.
Kind Regards
Six42
|
Hi six42, thanks It was fixed by creating default constructor(). Is it correct? Because it seems MUAuthenticator(file: String) won't be invoked and file location is hardcoded now. |
:)
|
Hello
I tried to write my own Authenticator class in scala to use it further. Here is the code:
And then I added line to plugins.properties:
Authenticator=fitnesse.mod.MUAuthenticator
It fails on start:
As for WritingPlugins
Where is the plugins folder or how can I setup Fitnesse classpath correctly?
Classpath is defined and is working well with my tests but It can't find the class in the same jar where my tests are.
Could you help me with it?
The text was updated successfully, but these errors were encountered: