@inspire-platform/sails-hook-auth
Version:
Passport-based User Authentication system for sails.js applications.
490 lines • 12.2 kB
JSON
{
"swagger" : "2.0",
"info" : {
"title" : "sails-hook-auth"
},
"tags" : [ {
"name" : "auth",
"description" : "Authentication"
}, {
"name" : "user",
"description" : "User collection"
} ],
"consumes" : [ "application/json" ],
"paths" : {
"/auth/local" : {
"post" : {
"tags" : [ "auth" ],
"summary" : "Authenticate locally guys",
"description" : "Authenticate locally",
"operationId" : "authLocal",
"parameters" : [ {
"in" : "body",
"name" : "body",
"required" : false,
"schema" : {
"$ref" : "#/definitions/AuthLocal"
}
} ],
"responses" : {
"200" : {
"description" : "Authenticated User",
"schema" : {
"$ref" : "#/definitions/User"
}
}
},
"security" : [ ]
}
},
"/auth/logout" : {
"post" : {
"tags" : [ "auth" ],
"summary" : "Session logout",
"description" : "Destroys session for current user",
"operationId" : "authLogout",
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "Success",
"schema" : {
"$ref" : "#/definitions/Success"
}
}
},
"security" : [ ]
}
},
"/auth/accessPolicy" : {
"get" : {
"tags" : [ "auth" ],
"summary" : "Returns user access policy.",
"description" : "Returns access policy for currently authenticated user.",
"operationId" : "authAccessPolicy",
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "Model access policy.",
"schema" : {
"type" : "object",
"properties" : { }
}
}
},
"security" : [ ]
}
},
"/user" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Get Users",
"description" : "Returns a collection of Users",
"operationId" : "findUsers",
"parameters" : [ {
"name" : "limit",
"in" : "query",
"description" : "Max number of items to return.",
"required" : false,
"type" : "integer",
"default" : 0
}, {
"name" : "skip",
"in" : "query",
"description" : "Number of items to skip.",
"required" : false,
"type" : "integer",
"default" : 0
} ],
"responses" : {
"200" : {
"description" : "A collection of User objects foofoofoo",
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/UserPopulated"
}
}
}
}
},
"post" : {
"tags" : [ "user" ],
"summary" : "Create a User",
"description" : "Adds a new User to the collection.",
"operationId" : "createUser",
"parameters" : [ {
"in" : "body",
"name" : "body",
"required" : false,
"schema" : {
"$ref" : "#/definitions/UserNew"
}
} ],
"responses" : {
"200" : {
"description" : "User created",
"schema" : {
"$ref" : "#/definitions/User"
}
}
}
}
},
"/user/{id}" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Gets one User",
"description" : "Returns a single User by id.",
"operationId" : "findUserById",
"parameters" : [ {
"name" : "id",
"in" : "path",
"description" : "The user's ID",
"required" : true,
"type" : "string",
"format" : "uuid"
} ],
"responses" : {
"200" : {
"description" : "A User",
"schema" : {
"$ref" : "#/definitions/UserPopulated"
}
},
"404" : {
"description" : "User not found",
"schema" : {
"$ref" : "#/definitions/Error_2"
}
}
}
},
"delete" : {
"tags" : [ "user" ],
"summary" : "Delete a User",
"description" : "Deletes a single user.",
"operationId" : "destroyUserById",
"parameters" : [ {
"name" : "id",
"in" : "path",
"description" : "The user's ID",
"required" : true,
"type" : "string",
"format" : "uuid"
} ],
"responses" : {
"200" : {
"description" : "Deleted the User",
"schema" : {
"$ref" : "#/definitions/UserPopulated"
}
},
"404" : {
"description" : "User not found",
"schema" : {
"$ref" : "#/definitions/Error_2"
}
}
}
},
"patch" : {
"tags" : [ "user" ],
"summary" : "Update a User",
"description" : "Updates a single user.",
"operationId" : "updateUserById",
"parameters" : [ {
"name" : "id",
"in" : "path",
"description" : "The user's ID",
"required" : true,
"type" : "string",
"format" : "uuid"
}, {
"in" : "body",
"name" : "body",
"required" : false,
"schema" : {
"$ref" : "#/definitions/UserMod"
}
} ],
"responses" : {
"200" : {
"description" : "Updated the User",
"schema" : {
"$ref" : "#/definitions/User"
}
},
"404" : {
"description" : "User not found",
"schema" : {
"$ref" : "#/definitions/Error_2"
}
}
}
}
}
},
"definitions" : {
"AuthLocal" : {
"required" : [ "identifier", "password" ],
"properties" : {
"identifier" : {
"type" : "string",
"example" : "admin@example.com",
"description" : "Username or e-mail address"
},
"password" : {
"type" : "string",
"format" : "password",
"example" : "admin1234"
}
},
"title" : "Auth Local",
"description" : "Authenticate locally with a username and password.",
"example" : {
"identifier" : "admin@example.com",
"password" : "admin1234"
}
},
"UserNew" : {
"required" : [ "email", "password", "username" ],
"properties" : {
"username" : {
"type" : "string",
"example" : "admin"
},
"email" : {
"type" : "string",
"format" : "email",
"example" : "admin@example.com"
},
"firstName" : {
"type" : "string",
"example" : "Jim"
},
"middleName" : {
"type" : "string",
"example" : "Bob"
},
"lastName" : {
"type" : "string",
"example" : "Robertson"
},
"active" : {
"type" : "boolean",
"example" : true
},
"dashboardState" : {
"type" : "object",
"properties" : { }
},
"password" : {
"type" : "string",
"format" : "password",
"example" : "admin1234"
}
},
"title" : "New User",
"example" : {
"firstName" : "Jim",
"lastName" : "Robertson",
"dashboardState" : "{}",
"password" : "admin1234",
"active" : true,
"middleName" : "Bob",
"email" : "admin@example.com",
"username" : "admin"
}
},
"UserMod" : {
"properties" : {
"email" : {
"type" : "string",
"format" : "email",
"example" : "sales@example.com"
},
"firstName" : {
"type" : "string",
"example" : "Billy"
},
"middleName" : {
"type" : "string",
"example" : "Joe"
},
"lastName" : {
"type" : "string",
"example" : "Williams"
},
"active" : {
"type" : "boolean",
"example" : true
},
"dashboardState" : {
"type" : "object",
"properties" : { }
},
"password" : {
"type" : "string",
"example" : "sales5678"
}
},
"title" : "Modify User",
"description" : "User properties to modify.",
"example" : {
"firstName" : "Billy",
"lastName" : "Williams",
"dashboardState" : "{}",
"password" : "sales5678",
"active" : true,
"middleName" : "Joe",
"email" : "sales@example.com"
}
},
"User" : {
"allOf" : [ {
"$ref" : "#/definitions/Item"
}, {
"title" : "User Item"
}, {
"properties" : {
"username" : {
"type" : "string",
"example" : "admin"
},
"email" : {
"type" : "string",
"format" : "email",
"example" : "admin@example.com"
},
"firstName" : {
"type" : "string",
"example" : "Jim"
},
"middleName" : {
"type" : "string",
"example" : "Bob"
},
"lastName" : {
"type" : "string",
"example" : "Robertson"
},
"active" : {
"type" : "boolean",
"example" : true
},
"dashboardState" : {
"type" : "object",
"properties" : { }
},
"lastLogin" : {
"type" : "string",
"format" : "date-time",
"example" : "2017-06-14T14:13:53.949Z"
}
}
} ]
},
"UserPopulated" : {
"allOf" : [ {
"$ref" : "#/definitions/User"
}, {
"type" : "object",
"title" : "User Item Populated"
} ]
},
"Success" : {
"properties" : {
"code" : {
"type" : "string"
},
"message" : {
"type" : "string"
}
},
"example" : {
"code" : "code",
"message" : "message"
}
},
"Error" : {
"properties" : {
"code" : {
"type" : "string"
},
"message" : {
"type" : "string"
}
}
},
"Error_2" : {
"properties" : {
"code" : {
"type" : "string"
},
"message" : {
"type" : "string"
}
}
},
"Item" : {
"properties" : {
"id" : {
"type" : "string",
"format" : "uuid",
"example" : "f4c80808-ac4d-4eac-960e-5ca1f82a1145"
},
"createdAt" : {
"type" : "string",
"format" : "date-time",
"example" : "2017-06-14T14:13:53.949Z"
},
"updatedAt" : {
"type" : "string",
"format" : "date-time",
"example" : "2017-06-14T14:13:53.949Z"
}
},
"title" : "Item"
},
"Success_2" : {
"properties" : {
"code" : {
"type" : "string"
},
"message" : {
"type" : "string"
}
},
"example" : {
"code" : "code",
"message" : "message"
}
}
},
"parameters" : {
"Limit" : {
"name" : "limit",
"in" : "query",
"description" : "Max number of items to return.",
"required" : false,
"type" : "integer",
"default" : 0
},
"Skip" : {
"name" : "skip",
"in" : "query",
"description" : "Number of items to skip.",
"required" : false,
"type" : "integer",
"default" : 0
}
},
"responses" : {
"ErrorUser404" : {
"description" : "User not found",
"schema" : {
"$ref" : "#/definitions/Error_2"
}
}
}
}