Code Monkey home page Code Monkey logo

personatestuser.org's Introduction

personatestuser.org is a service that makes it easy to write automated tests of persona login on your site.

Overview

This system furnishes an API for creating temporary Persona accounts. The email accounts intended for testing the Persona service. They are valid for two hours, after which time they will automatically be canceled. Specifically, the API permits you to:

  • Get a new verified email and password
  • Get a new unverivied email and password
  • Get a new verified email, password, and assertion for a certain audience
  • Get an assertion for a certian audience using an existing email
  • Delete an email account (happens automatically on expiration)

Some of these functions can be performed directly in the web console, but it is assumed that the most common use cases will depend on curl or programmatic approaches.

API

The queries are all HTTP GETs; they return JSON. Sometimes, an optional final argument env may be applied. This may be one of prod, stage, dev, local, or custom. The default is prod.

The first three (prod, stage, and dev) are shorthand for the Persona production, staging, and development instances. local is shorthand for localhost.

If you specify custom, you must provide two parameters: browserid and verifier, specifying which urls personatestuser should use.

For example, this gets a new verified email address from Persona:

GET /email/

This gets a verified email using a custom Persona deployment:

GET /email/custom?browserid=my.ephemeral.org&verifier=my.ephemeral.org/verify

You can also use an IP address:

GET /email/custom?browserid=12.34.56.78&verifier=12.34.56.78/verify

All queries return a JSON string on success with some or all of the following fields:

  • email An email to use as an identity
  • pass The password for the account
  • token A verification token for use with the identity provider
  • expires Expiration date in seconds since the epoch
  • env The name of the server environment ("prod", "dev", "stage", "local", "custom")
  • browserid The url for the IdP specified by env
  • verifier The url for the verifier specified by env
  • audience The audience an assertion is valid for
  • assertion An identity assertion for a given audience
  • cert An identity certificate from the IdP for the email
  • bundle A bundled assertion and certificate

New Verified Email

GET /email[/<env>]

Creates an identity that will be valid for an hour.

New Unverified Email

GET /unverified_email[/<env>]

Stages a new identity with the IdP. Use the returned verification token to complete the account creation.

New Assertion and Email

GET /email_with_assertion/<audience>[/<env>]

Get a new verified email and an assertion, valid for two minutes, for the named audience.

Audience must include the protocol (https://) and be url-encoded. For example, rather than jedp.gov, the audience would be https%3A%2F%2fjedp.gov. (Though this is a bit cumbersome, we prefer that the input you're sending to the BrowserID verifier be completely transparent.)

New Assertion

Like the above, but with explicit parameters for email and password.

If the email is current, the password must be correct.

If the email is not current, a new, verified email will be created with the new password. Not only is this a handy shortcut for account creation, but it also lets you automatically resuscitate accounts that have expired and been canceled.

GET /assertion/<audience>/<email>/<password>

Note that env is not an option, since the email has already been created for a certain server environment.

Again, the audience must include the protocol and be url-encoded.

Cancel Account

GET /cancel/<email>/<password>

Cancel the email account for given email and password. Note that env is not an option in this query, since the email has already been create for a certain env.

You do not need to cancel accounts created with this tool. Email accounts are automatically canceled with the IdP after one hour.

personatestuser.org's People

Contributors

jedp avatar lloyd avatar ozten avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar

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.