Reputation: 153
I used the samples to add simple authentication to my app. with the annotation of:
@Security.Authenticated(ShlangAuthenticator.class)
public static Result processShlangCommand()
And the class ShlangAuthenticator is based on the sample:
public class ShlangAuthenticator extends Security.Authenticator {
@Override
public String getUsername(Context ctx)
{
String s = ctx.session().get("email");
System.err.println("getUsernameCalled: " + s);
return s;
}
@Override
public Result onUnauthorized(Context ctx)
{
System.err.println("onUnauthorized called");
return redirect("http://localhost/#/login");
}
}
The problem I am getting is that every call to the Action (processShlangCommand() ) is being called twice by play (Play 2.1.1), I printed the stack trace and it seems to be identical. Any help on this would be appreciated.
Upvotes: 0
Views: 372
Reputation: 106
Perhaps it's because you're using System.err to log, instead of the default logger in play? Regardless, for authentication, I'm using this module: https://github.com/joscha/play-authenticate
Upvotes: 1