Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
53 lines (51 sloc) 1.89 KB
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="https://<%= @vars[:browserid_url] %>/provisioning_api.js"></script>
<script type="text/javascript" src="<%= @vars[:jquery_path] %>"></script>
<script type="text/javascript">
// an alias
var fail =;
// begin provisioning! This both gives us indicated to browserid that we're
// a well formed provisioning page and gives us the parameters of the provisioning, cert_duration) {
// now we have the email address that wishes to be provisioned!
// is he authenticated to
$.get('<%= @vars[:whoami_path] %>')
.success(function(r) {
email = email.replace('@<%= @vars[:domain_name] %>', '').toLowerCase();
if (email != r.user) {
return fail('user is not authenticated as target user');
// Awesome! The user is authenticated as who we want to provision. let's
// generate a keypair {
// finally, once we have a public key from the browser, we'll certify it, and
// go pass it back
url: '<%= @vars[:certify_path] %>',
data: JSON.stringify({
pubkey: pubkey,
duration: cert_duration
type: 'POST',
headers: { "Content-Type": 'application/json' },
dataType: 'json',
success: function(r) {
// all done! woo!;
error: function(r) {
fail("couldn't certify key");
.error(function() {
fail('user is not authenticated');