Skip to content

Update deps and use @node-oauth/oauth2-server #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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