Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
passport-oauth2-resource-owner-password
Advanced tools
Readme
OAuth 2.0 resource owner password authentication strategy for Passport.
This module lets you authenticate requests containing resource owner credentials in the request body, as defined by the OAuth 2.0 specification.
npm install passport-oauth2-resource-owner-password
The OAuth 2.0 resource owner password authentication strategy authenticates clients
using a client ID, username, and password
The strategy requires a verify
callback,
which accepts those credentials and calls done
providing a client.
passport.use(new ResourceOwnerPasswordStrategy(
function(clientId, clientSecret, username, password, done) {
Clients.findOne({ clientId: clientId }, function (err, client) {
// this strategy does not require clientSecret as it is intended to be used in cases
// (such as mobile apps) which are inherintly insecure
if (err) { return done(err); }
if (!client) { return done(null, false); }
Users.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
if (hashsum(user.salt + password) !== user.secret) { return done(null, false); }
return done(null, { client: client, user: user });
})
});
}
));
Use passport.authenticate()
, specifying the 'oauth2-resource-owner-password'
strategy, to authenticate requests.
For example, as route middleware in an Express application, using OAuth2orize middleware to implement the token endpoint:
app.get(
'/oauth/token'
, passport.authenticate(
[ 'basic'
, 'oauth2-client-password'
, 'oauth2-resource-owner-password'
]
, { session: false }
)
, oauth2orize.token()
, oauth2orize.errorHandler()
);
The example
included with OAuth2orize
demonstrates how to implement a complete OAuth 2.0 authorization server.
ResourceOwnerPasswordStrategy
is used to authenticate clients as they request access
tokens from the token endpoint.
TODO
npm install --dev
make test
The Client Password Strategy by Jared Hanson was used as a template to create this.
Copyright (c) 2012-2014 AJ ONeal <http://coolaj86.com/>
FAQs
OAuth 2.0 resource owner password authentication strategy for Passport.
The npm package passport-oauth2-resource-owner-password receives a total of 331 weekly downloads. As such, passport-oauth2-resource-owner-password popularity was classified as not popular.
We found that passport-oauth2-resource-owner-password demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.