API now checks user credentials before granting tokens.

Added new permission - 'api' that allows the group access to using the API.
This commit is contained in:
Lucas Nicodemus 2011-09-05 02:12:36 -06:00
parent 839ce793c7
commit 17683eaeaa
2 changed files with 23 additions and 0 deletions

View file

@ -18,11 +18,18 @@ namespace TShockAPI {
public void RegisterRestfulCommands()
{
Rest.Register(new RestCommand("/status", Status) {RequiesToken = false});
Rest.Register(new RestCommand("/tokentest", TokenTest) { RequiesToken = true });
//RegisterExamples();
}
#region RestMethods
object TokenTest(RestVerbs verbs, IParameterCollection parameters)
{
return new Dictionary<string, string>
{{"status", "200"}, {"response", "Token is valid and was passed through correctly."}};
}
object Status(RestVerbs verbs, IParameterCollection parameters)
{
var ReturnBlock = new Dictionary<string, string>();