{
  "_args": [
    [
      {
        "name": "nodulator-account",
        "raw": "nodulator-account@file:./src/Modules/Nodulator-Account",
        "rawSpec": "file:./src/Modules/Nodulator-Account",
        "scope": null,
        "spec": "/home/fgreiner/prog/js/Nodulator/src/Modules/Nodulator-Account",
        "type": "directory"
      },
      "/home/fgreiner/prog/js/Nodulator"
    ]
  ],
  "_from": "src/Modules/Nodulator-Account",
  "_id": "nodulator-account@0.0.7",
  "_inCache": true,
  "_installable": true,
  "_location": "/nodulator-account",
  "_phantomChildren": {
    "core-util-is": "1.0.2",
    "debug": "2.2.0",
    "inherits": "2.0.1",
    "isarray": "0.0.1",
    "methods": "1.1.2",
    "reduce-component": "1.0.1",
    "string_decoder": "0.10.31"
  },
  "_requested": {
    "name": "nodulator-account",
    "raw": "nodulator-account@file:./src/Modules/Nodulator-Account",
    "rawSpec": "file:./src/Modules/Nodulator-Account",
    "scope": null,
    "spec": "/home/fgreiner/prog/js/Nodulator/src/Modules/Nodulator-Account",
    "type": "directory"
  },
  "_requiredBy": [
    "/"
  ],
  "_resolved": "file:src/Modules/Nodulator-Account",
  "_shasum": "65ba720e2afcf40a2fc19bbbbd684f4377c1cb31",
  "_shrinkwrap": null,
  "_spec": "nodulator-account@file:./src/Modules/Nodulator-Account",
  "_where": "/home/fgreiner/prog/js/Nodulator",
  "author": {
    "email": "greine_f@epitech.eu",
    "name": "Champii"
  },
  "bugs": {
    "url": "https://github.com/Champii/Nodulator-Account/issues"
  },
  "dependencies": {
    "async": "^0.9.0",
    "cookie-parser": "1.3.3",
    "passport": "0.2.1",
    "passport-local": "1.0.0",
    "superagent": "^1.2.0",
    "supertest": "^0.15.0",
    "underscore": "^1.8.2"
  },
  "description": "Nodulator-Account",
  "devDependencies": {
    "coffee-script": "1.9.1",
    "mocha": "~2.0.1"
  },
  "homepage": "https://github.com/Champii/Nodulator-Account#readme",
  "license": "0",
  "main": "index.coffee",
  "name": "nodulator-account",
  "optionalDependencies": {},
  "readme": "Nodulator-Account\n=================\n\nMaster : [![Build Status](https://travis-ci.org/Champii/Nodulator-Account.svg?branch=master)](https://travis-ci.org/Champii/Nodulator-Account)\n\nDevelop: [![Build Status](https://travis-ci.org/Champii/Nodulator-Account.svg?branch=develop)](https://travis-ci.org/Champii/Nodulator-Account)\n\nNPM: [![npm version](https://badge.fury.io/js/nodulator-account.svg)](http://badge.fury.io/js/nodulator-account)\n\nReleased under [GPLv2](https://github.com/Champii/Nodulator-Account/blob/master/LICENSE.txt)\n\n##### Under heavy development\n\n___\n## Concept\n\nProvides ability to [Nodulator](https://github.com/Champii/Nodulator) to manage authentication, sessions and route permissions.\n\n___\n## Features\n\n- Basic mail authentication\n- Session management over Redis\n- File generation for login/signup views/directive for [Nodulator-Angular](https://github.com/Champii/Nodulator-Angular)\n- File generation for Server side `AccountResource`\n- Permission system\n\n___\n## JumpTo\n\n- [Installation](#installation)\n- [Basics](#basics)\n- [AccountResource](#accountresource)\n- [Permissions](#permissions)\n- [Project Generation](#project-generation)\n- [TODO](#todo)\n- [Changelog](#changelog)\n\n___\n## Installation\n\nYou can automaticaly install `Nodulator` and `Nodulator-Account` by running\n\n```\n$> sudo npm install -g Nodulator\n$> Nodulator install account\n```\n\nOr you can just run `npm` :\n\n```\n$> npm install nodulator nodulator-account\n```\n\n___\n## Basics\n\n```coffeescript\nNodulator = require 'nodulator'\nAccount = require 'nodulator-account'\n\nNodulator.Use Account\n```\n\n___\n## AccountResource\n\nThis module provides `Nodulator.AccountResource` that extends `Nodulator.Resource` and deals with every parts of app authentication.\n\nAuthentication is based on Passport\n\n```coffeescript\nclass PlayerResource extends Nodulator.AccountResource 'player'\n```\n\nDefaults fields for authentication are `'username'` and `'password'`\n\nYou can change them (optional) :\n\n```coffeescript\nconfig =\n  fields:\n    usernameField: 'login'\n    passwordField: 'pass'\n\nclass PlayerManager extends Nodulator.AccountResource 'player', config\n```\n\nThe passwordField of an AccountResource is never returned by the .ToJSON() method for evident security reasons.\n\nIt creates a custom method from `usernameField`\n\n```\n*FetchByUsername(username, done)\n\n  or here if customized\n\n*FetchByLogin(login, done)\n\n* Class methods\n```\n\nIt defines 2 routes (here when attached to a `PlayerResource`) :\n\n```\nPOST   => /api/1/players/login\nPOST   => /api/1/players/logout\n```\n\nIt setup session system, and thanks to Passport,\n\nIt fills `req.user` variable to handle public/authenticated routes\n\nYou have to `extend` yourself the `post` default route (for exemple) of your `AccountResource` to use it as a signup route.\n\n___\n## Permissions\n\nThere is two ways to deal with permissions: You can restrict a whole object:\n\n```coffeescript\nconfig =\n  restrict: Nodulator.Route.Auth()\n\nclass TestResource extends Nodulator.Resource 'test', Nodulator.Route, config\n\n```\n\nAnd/or a single API call (see exemples below)\n\n\nThe `Route` object exposes 3 middleware to manage permissions :\n\n#### Nodulator.Route.Auth()\n\nThis middleware checks if the current user is logged in, or returns a 403 forbidden if not.\n\n```coffeescript\nclass TestRoute extends Nodulator.Route\n  Config: ->\n    super()\n\n    #You have shorcuts for every perission call\n    #made inside a Route. (here: @Auth())\n    @Get @Auth(), (req, res) =>\n      [...]\n      # This call will be executed only if user is logged\n```\n\n#### Nodulator.Route.HasProperty(object)\n\nThis middleware checks if the current user is logged in and have the specified properties set\n\n```coffeescript\nclass TestRoute extends Nodulator.Route\n  Config: ->\n    super()\n\n    @Get @HasProperty({group_id: 2}), (req, res) =>\n      [...]\n      # This call will be executed only if user is logged\n      # and have the property group_id set to '2'\n```\n\n#### Nodulator.Route.IsOwn(string)\n\nThis middleware checks if the current user is logged in and the route param specified is own user.id\n\n```coffeescript\nclass TestRoute extends Nodulator.Route\n  Config: ->\n    super()\n\n    @Get '/:player_id', @IsOwn('player_id'), (req, res) =>\n      [...]\n      # This call will be executed only if user is logged\n      # and have (user.id === req.params.player_id)\n```\n#### SelfMade permissions\n\nYou can make your own permissions using the express middleware system.\nYour function must take (req, res, next) ->, or return a function that takes these parameters.\nPlease refer to the express documentation if you don't know what a middleware is.\n\n___\n## Project Generation\n\nSee [Nodulator's project generation](https://github.com/Champii/Nodulator#project-generation)\n\nWhen calling `$> Nodulator init`, it will automaticaly create following structure if non-existant:\n\n```\n/\n└─ server/\n   └─ resources/\n      └─ ClientResource.coffee\n```\n\nIf [Nodulator-Angular](https://github.com/Champii/Nodulator-Angular) is installed, it also create this structure :\n\n```\n/\n└─ client/\n   ├─ auth.jade\n   ├─ directives/\n   │  └─ AuthDirective.coffee\n   ├─ services/\n   │  └─ UserService.coffee\n   └─ views/\n      └─ auth.jade\n```\n\nThis structure contains a directive/view pair for asking user to login/signup,\na UserService to manage client-side session, and a global auth.jade view to render.\n\nIf no `Nodulator-Angular` module is found, but a [Nodulator-Assets](https://github.com/Champii/Nodulator-Assets) is, a simple `client/auth.jade` file is added to handle basic authentication.\n\n___\n## TODO\n\n- Better test suite\n- Social signup\n\n___\n## Changelog\n\nXX/XX/XX: current (not released yet)\n  - Fixed error in package generation, when Init, it never add support for angular or raw client\n  - Login and Logout callbacks now take req instead of req.user\n\n03/05/15: v0.0.7\n  - Fixed bad 403 when `IsOwn(key)` is used on a route without the given key in params\n  - Fixed req.user undefined when used in a Resource defined before AccountResource\n  - Tests\n\n14/04/15: v0.0.6\n  - Adding `Nodulator.Route.Auth()` permission call\n  - Adding `Nodulator.Route.HasProperty(object)` permission call\n  - Adding `Nodulator.Route.IsOwn(string)` permission call\n  - You can add permissions on certains api call or on a whole `Route` object (config.restrict)\n  - Added unit tests for basic auth and permissions\n\n10/04/15: v0.0.5\n  - The userField.passwordField of .ToJSON() is not returned anymore\n  - Fixed generation problem with no nodulator-assets included\n  - Different generation if `Nodulator-Angular`, `Nodulator-Assets`, both or none of them\n\n20/01/15: v0.0.4\n  - Fixed bugs about `@_table`\n\n20/01/15: v0.0.3\n  - Fixed bugs\n\n03/01/15: v0.0.2\n  - Fixed bug on auth when custom userFields\n\n03/01/15: v0.0.1\n  - Initial release\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git://github.com/Champii/Nodulator-Account.git"
  },
  "scripts": {
    "test": "mocha --compilers coffee:coffee-script/register test"
  },
  "version": "0.0.7"
}
