qwebs-oauth2
v0.0.2
Published
Create an OAuth2 provider for qwebs server.
Downloads
2
Maintainers
Readme
qwebs-oauth2
OAuth2 service for Qwebs server.
Features
Override the default OAuth2 model
"use strict";
const DataError = require("qwebs").DataError;
const Options = require("qwebs-oauth2).Options;
class OAuth2Options extends Options {
getAccessToken(bearerToken) {
throw new DataError({ message: "Not implemented" });
}
getClient(clientId, clientSecret) {
throw new DataError({ message: "Not implemented" });
}
getRefreshToken(refreshToken) {
throw new DataError({ message: "Not implemented" });
}
getUser(username, password) {
throw new DataError({ message: "Not implemented" });
}
saveToken(token, client, user) {
throw new DataError({ message: "Not implemented" });
}
};
exports = module.exports = OAuth2Model;
Define OAuth2 and inject OAuth2 model as $oauth2-model in routes.json
{
"services": [
{ "name": "$oauth2-model", "location": "./my-oauth2-model" }
{ "name": "$oauth2", "location": "qwebs-oauth2" }
],
"locators": [
{ "post": "/oauth/token", "service": "$oauth2", "method": "token" };
{ "get": "/secret", "service": "$oauth2", "method": "secret" }
]
}
Installation
$ npm install qwebs-oauth2
Test
To run our tests, clone the qwebs-oauth2 repo and install the dependencies.
$ git clone https://github.com/BenoitClaveau/qwebs-oauth2 --depth 1
$ cd qwebs-oauth2
$ npm install
$ mongod --dbpath ./data/db
$ node.exe "..\node_modules\jasmine-node\bin\jasmine-node" --verbose tests