Skip to content

Commit

Permalink
Rename repository and update to npm scope (#41)
Browse files Browse the repository at this point in the history
* Rename repository and update to npm scope

* Update Codeclimate token
  • Loading branch information
daffl committed Aug 29, 2018
1 parent d6921b7 commit 196d8c7
Show file tree
Hide file tree
Showing 8 changed files with 740 additions and 750 deletions.
2 changes: 1 addition & 1 deletion packages/authentication-jwt/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_js:
- '6'
addons:
code_climate:
repo_token: 7b5edc43d3ae8424cdc25360173f80638fc9da279f597b9c8eb8df2bd4ede0a7
repo_token: dbbeb7f2781d54d104578ff891500c1ec7a13a3d394af8650bf340e606e9ec29
notifications:
slack:
rooms:
Expand Down
27 changes: 13 additions & 14 deletions packages/authentication-jwt/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# feathers-authentication-jwt
# @feathersjs/authentication-jwt

[![Greenkeeper badge](https://badges.greenkeeper.io/feathersjs/feathers-authentication-jwt.svg)](https://greenkeeper.io/)
[![Greenkeeper badge](https://badges.greenkeeper.io/feathersjs/authentication-jwt.svg)](https://greenkeeper.io/)

[![Build Status](https://travis-ci.org/feathersjs/feathers-authentication-jwt.png?branch=master)](https://travis-ci.org/feathersjs/feathers-authentication-jwt)
[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-authentication-jwt/badges/gpa.svg)](https://codeclimate.com/github/feathersjs/feathers-authentication-jwt)
[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-authentication-jwt/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-authentication-jwt/coverage)
[![Dependency Status](https://img.shields.io/david/feathersjs/feathers-authentication-jwt.svg?style=flat-square)](https://david-dm.org/feathersjs/feathers-authentication-jwt)
[![Download Status](https://img.shields.io/npm/dm/feathers-authentication-jwt.svg?style=flat-square)](https://www.npmjs.com/package/feathers-authentication-jwt)
[![Build Status](https://travis-ci.org/feathersjs/authentication-jwt.png?branch=master)](https://travis-ci.org/feathersjs/authentication-jwt)
[![Test Coverage](https://codeclimate.com/github/feathersjs/authentication-jwt/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/authentication-jwt/coverage)
[![Dependency Status](https://img.shields.io/david/feathersjs/authentication-jwt.svg?style=flat-square)](https://david-dm.org/feathersjs/authentication-jwt)
[![Download Status](https://img.shields.io/npm/dm/@feathersjs/authentication-jwt.svg?style=flat-square)](https://www.npmjs.com/package/@feathersjs/authentication-jwt)

> JWT authentication strategy for feathers-authentication using Passport
## Installation

```
npm install feathers-authentication-jwt --save
npm install @feathersjs/authentication-jwt --save
```

## Documentation

<!-- Please refer to the [feathers-authentication-jwt documentation](http://docs.feathersjs.com/) for more details. -->
<!-- Please refer to the [@feathersjs/authentication-jwt documentation](http://docs.feathersjs.com/) for more details. -->

## API

Expand All @@ -30,7 +29,7 @@ This module contains 3 core pieces:

### Main Initialization

In most cases initializing the `feathers-authentication-jwt` module is as simple as doing this:
In most cases initializing the `@feathersjs/authentication-jwt` module is as simple as doing this:

```js
app.configure(authentication(settings));
Expand Down Expand Up @@ -74,7 +73,7 @@ The `Verifier` class can be extended so that you customize it's behavior without
An example of customizing the Verifier:
```js
import jwt, { Verifier } from 'feathers-authentication-jwt';
import jwt, { Verifier } from '@feathersjs/authentication-jwt';

class CustomVerifier extends Verifier {
// The verify function has the exact same inputs and
Expand All @@ -95,7 +94,7 @@ This is a collection of functions provided by [passport-jwt](https://github.com/
```js
// Example of pulling from the body instead
import jwt, { ExtractJwt } from 'feathers-authentication-jwt';
import jwt, { ExtractJwt } from '@feathersjs/authentication-jwt';

app.configure(jwt({ jwtFromRequest: ExtractJwt.fromBodyField('accessToken') }));
```
Expand All @@ -112,7 +111,7 @@ By default, this strategy expects a payload in this format:
## Complete Example
Here's a basic example of a Feathers server that uses `feathers-authentication-jwt`. You can see a fully working example in the [example/](./example/) directory.
Here's a basic example of a Feathers server that uses `@feathersjs/authentication-jwt`. You can see a fully working example in the [example/](./example/) directory.
```js
const feathers = require('feathers');
Expand All @@ -122,7 +121,7 @@ const memory = require('feathers-memory');
const bodyParser = require('body-parser');
const errorHandler = require('feathers-errors/handler');
const auth = require('feathers-authentication');
const jwt = require('feathers-authentication-jwt');
const jwt = require('@feathersjs/authentication-jwt');

// Initialize the application
const app = feathers()
Expand Down
6 changes: 3 additions & 3 deletions packages/authentication-jwt/example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# feathers-authentication-jwt Example
# @feathersjs/authentication-jwt Example

This provides a complete working example on how to use `feathers-authentication-jwt` to provide JWT authentication and get a JWT access token upon successful authentication or to enforce authentication of a service or endpoint.
This provides a complete working example on how to use `@feathersjs/authentication-jwt` to provide JWT authentication and get a JWT access token upon successful authentication or to enforce authentication of a service or endpoint.

1. Start the app by running `npm start`
2. Make a request using the JWT access token outputted in the console.
Expand All @@ -13,4 +13,4 @@ curl -H "Authorization: <your access token>" -X POST http://localhost:3030/authe
**Hitting a protected resource**
```bash
curl -H "Authorization: <your access token>" http://localhost:3030/users
```
```
4 changes: 2 additions & 2 deletions packages/authentication-jwt/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const pick = require('lodash.pick');
const DefaultVerifier = require('./verifier');
const passportJwt = require('passport-jwt');

const debug = Debug('feathers-authentication-jwt');
const debug = Debug('@feathersjs/authentication-jwt');
const defaults = {
name: 'jwt',
bodyKey: 'accessToken'
Expand All @@ -28,7 +28,7 @@ module.exports = function init (options = {}) {
const { ExtractJwt, Strategy } = passportJwt;

if (!app.passport) {
throw new Error(`Can not find app.passport. Did you initialize feathers-authentication before feathers-authentication-jwt?`);
throw new Error(`Can not find app.passport. Did you initialize feathers-authentication before @feathersjs/authentication-jwt?`);
}

let authOptions = app.get('auth') || app.get('authentication') || {};
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication-jwt/lib/verifier.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Debug = require('debug');
const debug = Debug('feathers-authentication-jwt:verify');
const debug = Debug('@feathersjs/authentication-jwt:verify');

class JWTVerifier {
constructor (app, options = {}) {
Expand All @@ -8,7 +8,7 @@ class JWTVerifier {
this.service = typeof options.service === 'string' ? app.service(options.service) : options.service;

if (!this.service) {
throw new Error(`options.service does not exist.\n\tMake sure you are passing a valid service path or service instance and it is initialized before feathers-authentication-jwt.`);
throw new Error(`options.service does not exist.\n\tMake sure you are passing a valid service path or service instance and it is initialized before @feathersjs/authentication-jwt.`);
}

this.verify = this.verify.bind(this);
Expand Down
Loading

0 comments on commit 196d8c7

Please sign in to comment.