Giter VIP home page Giter VIP logo

passport-dataporten's Introduction

Passport Strategy for Dataporten

Passport strategy for authenticating with Dataporten using the OAuth 2.0 API.

Install

npm install passport-dataporten --save

Usage

Use the helper Setup class for simple and flexible passportjs setup:

var Dataporten = require('passport-dataporten');
var app = express();

var config = {
	"clientID": "10ad9f43-1ba3-4cb2-a459-1f9b3af25ac1",
	"clientSecret": "4175677a-06f8-4cc3-8224-2f858d18b610",
  "sessionkey": "d6096809-4d65-4931-b7d3-97637fc70e88",
	"callbackURL": "http://localhost:8080/auth/dataporten/callback",
};
var dataportenSetup = new Dataporten.Setup(config);

app.use(dpsetup.passport.initialize());
app.use(dpsetup.passport.session());

dpsetup.setupAuthenticate(app, '/login');
dpsetup.setupLogout(app, '/logout');
dpsetup.setupCallback(app);

Use Dataporten.Authz for authorization:

var authzConfig = {"redirectOnNoAccess": "/login"};
var dataportenAuthorizationMiddleware = (new Dataporten.Authz(authzConfig))
	.allowUsers(['eeb5bad8-c466-4393-91cc-6fb61807e4dd'])
	.allowGroups(['fc:adhoc:892fe78e-14cd-43b1-abf8-b453a2c7758d'])
	.middleware();
app.use('/', dataportenAuthorizationMiddleware);

Thanks

License

The ISC License

Copyright © 2015-2017 UNINETT AS

passport-dataporten's People

Contributors

andreassolberg avatar jornane avatar kedano avatar knumor avatar sigmunau avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

frodengrd cisnes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.