passport-openid
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -199,2 +199,176 @@ /** | ||
/** | ||
* Register a function used to save associations. | ||
* | ||
* An association establishes a shared secret between a relying party and an | ||
* OpenID provider, which is used to verify subsequent protocol messages and | ||
* reduce round trips. Registering a function allows an application to | ||
* implement storage of associations as necessary. | ||
* | ||
* The function accepts six arguments: `handle`, `provider`, `algorithm`, | ||
* `secret`, `expiresIn`, and `done` a callback to invoke when the association | ||
* has been saved. | ||
* | ||
* After the association has been saved, the corresponding `loadAssociation` | ||
* function will be used to load it when needed. | ||
* | ||
* Internally, this function makes use of `saveAssociation` in the underlying | ||
* node-openid module. Refer to that for more information. Note, however, that | ||
* the argument order has been modified to pass `handle` as the first argument, | ||
* as it is naturally the key used to later load the association. | ||
* | ||
* Examples: | ||
* | ||
* strategy.saveAssociation(function(handle, provider, algorithm, secret, expiresIn, done) { | ||
* saveAssoc(handle, provider, algorithm, secret, expiresIn, function(err) { | ||
* if (err) { return done(err) } | ||
* return done(); | ||
* }); | ||
* }); | ||
* | ||
* References: | ||
* - [Establishing Associations](http://openid.net/specs/openid-authentication-2_0.html#associations) | ||
* | ||
* @param {Function} fn | ||
* @return {Strategy} for chaining | ||
* @api public | ||
*/ | ||
Strategy.prototype.saveAssociation = function(fn) { | ||
// wrap to make `handle` the first argument to `fn`. this order is more | ||
// natural due to the fact that `handle` this is the "key" when subsequently | ||
// loading the association. | ||
openid.saveAssociation = function(provider, type, handle, secret, expiry, callback) { | ||
fn(handle, provider, type, secret, expiry, callback) | ||
} | ||
return this; // return this for chaining | ||
} | ||
/** | ||
* Register a function used to load associations. | ||
* | ||
* An association establishes a shared secret between a relying party and an | ||
* OpenID provider, which is used to verify subsequent protocol messages and | ||
* reduce round trips. Registering a function allows an application to | ||
* implement loading of associations as necessary. | ||
* | ||
* The function accepts two arguments: `handle` and `done` a callback to invoke | ||
* when the association has been loaded. `done` should be invoked with a | ||
* `provider`, `algorithm`, and `secret` (or `err` if an exception occurred). | ||
* | ||
* This function is used to retrieve associations previously saved with the | ||
* corresponding `saveAssociation` function. | ||
* | ||
* Internally, this function makes use of `loadAssociation` in the underlying | ||
* node-openid module. Refer to that for more information. Note, however, that | ||
* the callback is supplied with `provider`, `algorithm`, and `secret` as | ||
* individual arguments, rather than a single object containing them as | ||
* properties. | ||
* | ||
* Examples: | ||
* | ||
* strategy.loadAssociation(function(handle, done) { | ||
* loadAssoc(handle, function(err, provider, algorithm, secret) { | ||
* if (err) { return done(err) } | ||
* return done(null, provider, algorithm, secret) | ||
* }); | ||
* }); | ||
* | ||
* References: | ||
* - [Establishing Associations](http://openid.net/specs/openid-authentication-2_0.html#associations) | ||
* | ||
* @param {Function} fn | ||
* @return {Strategy} for chaining | ||
* @api public | ||
*/ | ||
Strategy.prototype.loadAssociation = function(fn) { | ||
// wrap to allow individual arguments to `done` callback. this seems more | ||
// natural since these were individual arguments to the corresponding | ||
// `saveAssociation` function. | ||
openid.loadAssociation = function(handle, callback) { | ||
fn(handle, function(err, provider, algorithm, secret) { | ||
if (err) { return callback(err, null); } | ||
var obj = { | ||
provider: provider, | ||
type: algorithm, | ||
secret: secret | ||
} | ||
return callback(null, obj); | ||
}); | ||
} | ||
return this; // return this for chaining | ||
} | ||
/** | ||
* Register a function used to cache discovered info. | ||
* | ||
* Caching discovered information about a provider can significantly speed up | ||
* the verification of positive assertions. Registering a function allows an | ||
* application to implement storage of this info as necessary. | ||
* | ||
* The function accepts three arguments: `identifier` (which serves as a key to | ||
* the provider information), `provider` (the provider information being | ||
* cached), and `done` a callback to invoke when the information has been | ||
* stored. | ||
* | ||
* After the data has been cached, the corresponding `loadDiscoveredInfo` | ||
* function will be used to look it up when needed. | ||
* | ||
* This corresponds directly to the `saveDiscoveredInformation` provided by the | ||
* underlying node-openid module. Refer to that for more information. | ||
* | ||
* Examples: | ||
* | ||
* strategy.saveDiscoveredInfo(function(identifier, provider, done) { | ||
* saveInfo(identifier, provider, function(err) { | ||
* if (err) { return done(err) } | ||
* return done(); | ||
* }); | ||
* }; | ||
* | ||
* @param {Function} fn | ||
* @return {Strategy} for chaining | ||
* @api public | ||
*/ | ||
Strategy.prototype.saveDiscoveredInfo = | ||
Strategy.prototype.saveDiscoveredInformation = function(fn) { | ||
openid.saveDiscoveredInformation = fn; | ||
return this; // return this for chaining | ||
} | ||
/** | ||
* Register a function used to load discovered info from cache. | ||
* | ||
* Caching discovered information about a provider can significantly speed up | ||
* the verification of positive assertions. Registering a function allows an | ||
* application to implement laoding of this info as necessary. | ||
* | ||
* The function accepts two arguments: `identifier` (which serves as a key to | ||
* the provider information), and `done` a callback to invoke when the | ||
* information has been loaded. | ||
* | ||
* This function is used to retrieve data previously cached with the | ||
* corresponding `saveDiscoveredInfo` function. | ||
* | ||
* This corresponds directly to the `loadDiscoveredInformation` provided by the | ||
* underlying node-openid module. Refer to that for more information. | ||
* | ||
* Examples: | ||
* | ||
* strategy.loadDiscoveredInfo(function(identifier, done) { | ||
* loadInfo(identifier, function(err, provider) { | ||
* if (err) { return done(err) } | ||
* return done(); | ||
* }); | ||
* }); | ||
* | ||
* @param {Function} fn | ||
* @return {Strategy} for chaining | ||
* @api public | ||
*/ | ||
Strategy.prototype.loadDiscoveredInfo = | ||
Strategy.prototype.loadDiscoveredInformation = function(fn) { | ||
openid.loadDiscoveredInformation = fn; | ||
return this; // return this for chaining | ||
} | ||
/** | ||
@@ -201,0 +375,0 @@ * Parse user profile from OpenID response. |
{ | ||
"name": "passport-openid", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "OpenID authentication strategy for Passport.", | ||
@@ -5,0 +5,0 @@ "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21109
516