Skip to content

Commit

Permalink
Merge pull request #7 from node-oauth/3.0.0
Browse files Browse the repository at this point in the history
Update deps and use @node-oauth/oauth2-server
  • Loading branch information
jankapunkt committed May 26, 2023
2 parents 519b939 + 986ffb0 commit c2a8b11
Show file tree
Hide file tree
Showing 19 changed files with 2,846 additions and 778 deletions.
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "eslint:recommended",
"env": {
"node": true,
"mocha": true,
"es6": false
},
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"ecmaFeatures" : {
"globalReturn": false,
"impliedStrict": true,
"jsx": false
}
}
}

4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
node: [14, 16, 18]
steps:
- name: Checkout ${{ matrix.node }}
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
Expand All @@ -33,7 +33,7 @@ jobs:
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}
- run: npm i
- run: npm ci
- run: npm run test:coverage

# with the following action we enforce PRs to have a high coverage
Expand Down
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
node_modules/
docs/_build/
__pycache__/
*.pyc
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.iml

.idea
.jshint
.DS_Store

pids
logs
results

lib/dockerImage/keys
coverage
npm-debug.log*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
.elc
auto-save-list
tramp
.\#*
.vscode

# Org-mode
.org-id-locations
*_archive

# coverage
.nyc_output

package-lock.json
yarn.lock
1 change: 0 additions & 1 deletion .jshintignore

This file was deleted.

29 changes: 0 additions & 29 deletions .jshintrc

This file was deleted.

5 changes: 3 additions & 2 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
recursive: true
reporter: "spec"
retries: 1
retries: 0
slow: 20
timeout: 2000
ui: "bdd"
require: test/assertions
exit: true
# require: test/assertions
# for more options see here https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.yml
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test/
examples/
package-lock.json
yarn.lock
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 3.0.0
- use @node-oauth/oauth2-server
- update all dependencies to latest
- add code coverage to tests
- add GitHub actions CI
- replace jshint with eslint

---
These previous versions are from the forked `oauthjs` org.
We did not publish them are related in any way to these publications.

## 2.0.0
* Refactor for v3.0.0 of node-oauth2-server

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Seegno
Copyright (c) 2015 - Today Seegno and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
22 changes: 16 additions & 6 deletions Readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
# Express OAuth Server [![Build Status](https://travis-ci.org/oauthjs/express-oauth-server.png?branch=master)](https://travis-ci.org/oauthjs/express-oauth-server)
# Express OAuth Server

Complete, compliant and well tested module for implementing an OAuth2 Server/Provider with [express](https://github.com/expressjs/express) in [node.js](http://nodejs.org/).

This is the express wrapper for [oauth2-server](https://github.com/oauthjs/node-oauth2-server).
[![Tests](https://github.com/node-oauth/express-oauth-server/actions/workflows/tests.yml/badge.svg)](https://github.com/node-oauth/express-oauth-server/actions/workflows/tests.yml)
[![CodeQL](https://github.com/node-oauth/express-oauth-server/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/node-oauth/express-oauth-server/actions/workflows/github-code-scanning/codeql)
![GitHub](https://img.shields.io/github/license/node-oauth/express-oauth-server)


This is the express wrapper for [@node-oauth/oauth2-server](https://github.com/node-oauth/node-oauth2-server),
it's a fork from the former [oauthjs/express-oauth-server](https://github.com/oauthjs/express-oauth-server).

## Installation

$ npm install express-oauth-server
```shell
$ npm install @node-oauth/express-oauth-server
```

## Quick Start

The module provides two middlewares - one for granting tokens and another to authorize them. `express-oauth-server` and, consequently `oauth2-server`, expect the request body to be parsed already.
The module provides two middlewares - one for granting tokens and another to authorize them.
`@node-oauth/express-oauth-server` and, consequently `@node-oauth/oauth2-server`,
expect the request body to be parsed already.
The following example uses `body-parser` but you may opt for an alternative library.

```js
var bodyParser = require('body-parser');
var express = require('express');
var OAuthServer = require('express-oauth-server');
var OAuthServer = require('@node-oauth/express-oauth-server');

var app = express();

app.oauth = new OAuthServer({
model: {}, // See https://github.com/oauthjs/node-oauth2-server for specification
model: {}, // See https://github.com/node-oauth/node-oauth2-server for specification
});

app.use(bodyParser.json());
Expand Down
1 change: 1 addition & 0 deletions examples/mongodb/model.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global Promise */

/**
* Module dependencies.
Expand Down
2 changes: 1 addition & 1 deletion examples/postgresql/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

var bodyParser = require('body-parser');
var express = require('express');
var oauthServer = require('express-oauth-server');
var oauthServer = require('@node-oauth/express-oauth-server');
var render = require('co-views')('views');
var util = require('util');

Expand Down
5 changes: 4 additions & 1 deletion examples/postgresql/model.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable require-yield */

/**
/**
* Module dependencies.
*/

Expand Down Expand Up @@ -82,3 +83,5 @@ module.exports.saveAccessToken = function *(token, client, user) {
return result.rowCount ? result.rows[0] : false; // TODO return object with client: {id: clientId} and user: {id: userId} defined
});
};

/* eslint-enable require-yield */
1 change: 1 addition & 0 deletions examples/redis/model.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global Promise */

/**
* Module dependencies.
Expand Down
Loading

0 comments on commit c2a8b11

Please sign in to comment.