<commit_before># guardian

Authentication gateway middle-man for simplifying OAuth requests with a plugin based architecture to allow quick iteration and implementation of new authentication schemes outside of normal or existing flows.

Created with love by http://mashape.com

## Install

```bash
$ npm install guardian
```

## Starting

```bash
$ node index.js -c <configuration>
```

### Configuration

Configuration files can be found in the `config` directory, when no configuration file is declared `default.js` is loaded, when declaring which file to use omit the `js` extension like so:

```bash
$ node index.js -c production
```

Basic Options:

- `host`
  *You should set this to be the public ip or domain name as it is utilized to generate the callback uri.*

  Default: `localhost:3000`
- `protocol`
  *Host protocol*

  Default: `http`
- `port`
  *Port on which guardian runs*

  Default: `3000`
- `pid.dir`
  *Directory where the `.guardian.pid` file will be output, in production environments this is usually `/home/<user>/`, with trailing slash.*

  Default: `./`
- `redis.host`
- `redis.port`
- `redis.pass`

## Routes

Each endpoint functions as a step.

### Storage

    POST /store

Stores information given, returns hash to be used later on. `60` second life on the hashed information by default.

#### Parameters

**OAuth 2**
> Details specific to OAuth2

- `client_id`
- `client_secret`
- `grant_type`
  *Highly dependant on flow state, and which flow you are accessing. Common values:*
  - `authorization_code`
  - `client_credentials`
  - `password`
  - `refresh_token`
- `access_name` *access token name, default `access_token`*
- `authorize_method` *Optional; Authorization Header Method, default is `Bearer`*
  - Some Possible Values:
  - `Bearer` *default*
  - `OAuth`
  - `Digest`
- `state`
- `scope`

**OAuth 1**
> Details specific to OAuth 1.0a

- `consumer_key`
- `consumer_secret`
- `signature_method`
- `oauth_token`

**Authentication** *required*
> General information regarding authentication flow to load plugin, e.g.

- `auth_type` *a-z chars accepted only*

  Default: `oauth`
- `auth_flow` *optional; a-z_ chars accepted only*
  > This would be a specific flow, a niche if you may. Echo, Owner Resources, etc..
- `auth_version` *optional; numeric chars only*
  > What version of `auth_type` are we dealing with?
- `auth_leg` *optional; numeric chars only*
  > What leg of `auth_type` is this?

These are combined to create the plugin file name which is composed like so:

```js
type.lower + (flow? '_' + flow : '') + (version? '_' + version : '') + (leg? '_' + leg : '')
```

For example, OAuth 2 (3-legged) plugin:

```js
// plugins/oauth_2_3-legged.js

{
  auth_type: 'oauth',
  auth_version: 2,
  auth_leg: 3
}
```
<commit_msg>update readme, spacing<commit_after># guardian

Authentication gateway middle-man for simplifying OAuth requests with a plugin based architecture to allow quick iteration and implementation of new authentication schemes outside of normal or existing flows.

Created with love by http://mashape.com

## Install

```bash
$ npm install guardian
```

## Starting

```bash
$ node index.js -c <configuration>
```

### Configuration

Configuration files can be found in the `config` directory, when no configuration file is declared `default.js` is loaded, when declaring which file to use omit the `js` extension like so:

```bash
$ node index.js -c production
```

Basic Options:

- `host`
  *You should set this to be the public ip or domain name as it is utilized to generate the callback uri.*

  Default: `localhost:3000`
- `protocol`
  *Host protocol*

  Default: `http`
- `port`
  *Port on which guardian runs*

  Default: `3000`
- `pid.dir`
  *Directory where the `.guardian.pid` file will be output, in production environments this is usually `/home/<user>/`, with trailing slash.*

  Default: `./`
- `redis.host`
- `redis.port`
- `redis.pass`

## Routes

Each endpoint functions as a step.

### Storage

    POST /store

Stores information given, returns hash to be used later on. `60` second life on the hashed information by default.

#### Parameters

**OAuth 2**
> Details specific to OAuth2

- `client_id`
- `client_secret`
- `grant_type`
  *Highly dependant on flow state, and which flow you are accessing. Common values:*
  - `authorization_code`
  - `client_credentials`
  - `password`
  - `refresh_token`
- `access_name` *access token name, default `access_token`*
- `authorize_method` *Optional; Authorization Header Method, default is `Bearer`*
  - Some Possible Values:
  - `Bearer` *default*
  - `OAuth`
  - `Digest`
- `state`
- `scope`

**OAuth 1**
> Details specific to OAuth 1.0a

- `consumer_key`
- `consumer_secret`
- `signature_method`
- `oauth_token`

**Authentication** *required*
> General information regarding authentication flow to load plugin, e.g.

- `auth_type` *a-z chars accepted only*

  Default: `oauth`
- `auth_flow` *optional; a-z_ chars accepted only*

  > This would be a specific flow, a niche if you may. Echo, Owner Resources, etc..
- `auth_version` *optional; numeric chars only*

  > What version of `auth_type` are we dealing with?
- `auth_leg` *optional; numeric chars only*

  > What leg of `auth_type` is this?

These are combined to create the plugin file name which is composed like so:

```js
type.lower + (flow? '_' + flow : '') + (version? '_' + version : '') + (leg? '_' + leg : '')
```

For example, OAuth 2 (3-legged) plugin:

```js
// plugins/oauth_2_3-legged.js

{
  auth_type: 'oauth',
  auth_version: 2,
  auth_leg: 3
}
```

{'fraction_non_alphanumeric': 0.12077033837293016, 'fraction_numerical': 0.00755939524838013, 'mean_word_length': 3.935168738898757, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1806242', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1722, 'n_words': 668}