CypherX/xAuth — Issue #28: Improved AuthURL support
Author: moparisthebest
Created: 2012-02-28 21:09:23+00:00
State: open

Your post got me thinking of ways to improve AuthURL support, so, while keeping backwards compatibility, I've extended it to additionally support registration, and marking the player online or offline via authURL. This also solves issue #16 as the player IP is always sent to the script as well.

Here is the code:
https://gist.github.com/1935097

The javadocs should be clear enough, but, basically, you create a new instance, call the method you want, and print the response if it is not null.

Also read my comments at the top of AuthURL.java, I recommend, for clean, extensible code, you implement the Auth interface with your code to access and register your database, then have a method like so: (psuedocode)

public Auth getAuthClass(Player p){
if(settings.authURL_enabled)
return new AuthURL(settings.authURL, p.getIP(), settings.authURL_registration, settings.authURL_onlineoffline, settings.authURL_permissions);
else
return new YourAuth(yourparams);
}

Then just use whatever that returns and it destroys all of those nasty if/else/etc.

Also, as you can see from the code, if it is possible of course, I'd like xAuth to set the player's group to whatever the script returns if enabled (if group != null), that would make it possible to have forum groups that directly and immediately translate into permissions groups. Neat!

Thanks for all the hard work you do, and if I can help out at all, let me know. (or if you want me to implement this, or change something in the implementation, let me know)