The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::BrowserID::Verify - Verify BrowserID assertions.

VERSION

version 0.001

SYNOPSIS

  # Procedural API
  use Net::BrowserID::Verify qw(verifyRemotely);
  my $data = verifyRemotely('assertion', 'audience');

  # OO API
  use Net::BrowserID::Verify;
  my $verifier = Net::BrowserID::Verify->new({
      type     => q{remote},
      audience => q{http://localhost},
  });

  my $data = $verifier->verify('assertion');

CHECK DATA

Once you have $data from the verifier, you can then check if the status was okay.

  if ( $data->{status} eq 'okay' ) {
      # read $data->{email} to set up/login your user
      print $data->{email};
  }
  else {
      # something went wrong with the verification or the request
      print $data->{reason};
  }

DESCRIPTION

The assertion format you receive when using Persona/BrowserID needs to be sent from your browser to the server and verified there. This library helps you verify that the assertion is correct.

The data returned by verifyRemotely(), verifyLocally() or $verifier->verify() contains the following fields:

  • status

    The status of the verification. Either 'okay' or 'failure'.

  • email

    The email address which has been verified.

    Provided only when status is 'okay'.

  • issuer

    The issuer/identity provider, which should be either the domain of the email address being verified, or the fallback IdP.

    Provided only when status is 'okay'.

  • expires

    The expiry (in ms from epoch). e.g. 1354217396705.

    Provided only when status is 'okay'.

  • audience

    The audience you passed to the verifier.

    Provided only when status is 'okay'.

  • reason

    Gives the reason why something went wrong.

    Only provided if the status is 'failure'.

AUTHOR

Andrew Chilton "chilts@mozilla.com"

COPYRIGHT AND LICENSE

Copyright (c) 2013 Mozilla.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.