https://github.com/bayer-group/passport-ping-oauth2
Ping OAuth 2.0 authentication strategy for Passport.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.1%) to scientific vocabulary
Repository
Ping OAuth 2.0 authentication strategy for Passport.
Basic Info
- Host: GitHub
- Owner: Bayer-Group
- License: mit
- Language: JavaScript
- Default Branch: master
- Size: 23.4 KB
Statistics
- Stars: 5
- Watchers: 6
- Forks: 6
- Open Issues: 6
- Releases: 0
Metadata Files
README.md
passport-ping-oauth2
PingFederate OAuth 2.0 authentication strategy for Passport.
This module lets you authenticate using PingFederate in your Node.js applications. By plugging into Passport, Ping authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
Install
$ npm install passport-ping-oauth2
Usage
Configure Strategy
The Ping authentication strategy authenticates users using a Ping
account and OAuth 2.0 tokens. Ping's OAuth 2.0 endpoints, as well as
the client identifer and secret, are specified as options. The strategy
requires a verify callback, which receives an access token and profile,
and calls done providing a user.
passport.use(new OAuth2Strategy({
authorizationURL: 'https://www.example.com/as/authorization.oauth2',
tokenURL: 'https://www.example.com/as/token.oauth2',
clientID: EXAMPLE_CLIENT_ID,
clientSecret: EXAMPLE_CLIENT_SECRET,
callbackURL: "http://localhost:3000/auth/oauth2/callback'
},
function(accessToken, refreshToken, profile, done) {
User.findOne({ 'ping.id' : profile.id }, function (err, user) {
if (err) { return done(err); }
if (user) {
return done(null, user);
} else {
var newUser = new User();
newUser.ping.id = profile.id;
newUser.ping.token = accessToken;
newUser.ping.name = profile.displayName;
newUser.ping.email = profile.email;
newUser.save(function(err) {
if (err) { throw err; }
return done(null, newUser);
});
}
});
}
));
Authenticate Requests
Use passport.authenticate(), specifying the 'ping-oauth2' strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/oauth2',
passport.authenticate('oauth2', { scope : ['openid', 'profile', 'email'] }));
app.get('/auth/oauth2/callback',
passport.authenticate('oauth2', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
Related Modules
- passport-oauth2 — OAuth 2.0 authentication strategy
Tests
$ npm install
$ npm test
Credits
License
Owner
- Name: Bayer Open Source
- Login: Bayer-Group
- Kind: organization
- Website: https://bayer.com/
- Repositories: 98
- Profile: https://github.com/Bayer-Group
Science for a better life
GitHub Events
Total
Last Year
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Brenden McKamey | b****y@g****m | 1 |
| unknown | b****a@R****m | 1 |
| Kevin Huang | y****g@m****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 5
- Total pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: about 2 months
- Total issue authors: 5
- Total pull request authors: 2
- Average comments per issue: 0.4
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- bhavyaswork (1)
- rtm619 (1)
- leehendricks (1)
- thisisvijay (1)
- pawanzZ (1)
Pull Request Authors
- hahooy (1)
- thisisvijay (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- chai 2.x.x development
- chai-passport-strategy 0.2.x development
- mocha 2.x.x development
- oauth 0.9.x
- passport-strategy 1.x.x
- uid2 0.0.x