loginURL - An http address including a user/pass according to the http uri scheme.
Exmaple: - http://user:pass@webmakerServer.foo
Optional Options
verifyResponse - A callback used for custom actions needed for individual apps. It is returned:
res - The server response object.
data - Contains information useful to determine app specific actions such as:
** email - The email of the Persona Users
** user - An object containing information about this Webmaker user.
** status - Just general information if things didn’t fail.
Instantiating this module creates the GET /user/:id route in the parent app for use during SSO integration. It exposes the Webmaker username associated with valid persona credentials as req.session.username.
The route will return { status: "okay", user: user } when successful, and { status: "failure", reason: "error message" } when not.
Methods
The module returns an object with three methods:
loginHandle.getUserById ( id, callback )
…which retrieves the user model for the passed id, passing the callback the parameters ( errorString, userObject ) and
loginHandle.getUserByEmail ( email, callback )
…which retrieves the user model for the passed email, passing the callback the parameters ( errorString, userObject ) and
Webmaker-LoginAPI
Setup
Setup is easy! Add to your package.json and run
npm install.Integration
Pass the module:
Your app’s express instance
NOTE: Do not call the constructor-function returned by the
require()until all of your server’s general middleware has been declared.An options object that will pass options used for Express Persona and our SSO integration.
Required Options
audience- The URL of your express app when viewed in a browser. Must include the protocol, hostname, and port.http://example.org:80,https://example.org:443loginURL- An http address including a user/pass according to thehttpuri scheme.http://user:pass@webmakerServer.fooOptional Options
verifyResponse- A callback used for custom actions needed for individual apps. It is returned:res- The server response object.data- Contains information useful to determine app specific actions such as: **email- The email of the Persona Users **user- An object containing information about this Webmaker user. **status- Just general information if things didn’t fail.i.e.
API Exposure
Instantiating this module creates the
GET /user/:idroute in the parent app for use during SSO integration. It exposes the Webmaker username associated with valid persona credentials asreq.session.username.The route will return
{ status: "okay", user: user }when successful, and{ status: "failure", reason: "error message" }when not.Methods
The module returns an object with three methods:
loginHandle.getUserById ( id, callback )…which retrieves the user model for the passed
id, passing the callback the parameters( errorString, userObject )andloginHandle.getUserByEmail ( email, callback )…which retrieves the user model for the passed
email, passing the callback the parameters( errorString, userObject )andloginHandle.getUserByUsername ( username, callback )…which retrieves the user model for the passed
username, passing the callback the parameters( errorString, userObject )andTesting
Ensure the
gruntandmochanpm modules are installed globally, then rungruntmocha