NAME

WebService::Windows::LiveID::Auth - Perl implementation of Windows Live ID Web Authentication 1.0

VERSION

version 0.01

SYNOPSIS

use WebService::Windows::LiveID::Auth;

my $appid = '00163FFF80003203';
my $secret_key = 'ApplicationKey123';
my $appctx = 'zigorou';

my $auth = WebService::Windows::LiveID::Auth->new({
  appid => $appid,
  secret_key => $secret_key
});

local $\ = "\n";

print $auth->control_url; ### SignIn, SignOut links page by LiveID. Set this page url to iframe's src attribute.
print $auth->sign_in_url; ### SignIn page
print $auth->sign_out_url; ### SignOut page

In the request to "ReturnURL",

use CGI;
use WebService::Windows::LiveID::Auth;

my $q = CGI->new;

my $appid = '00163FFF80003203';
my $secret_key = 'ApplicationKey123';
my $appctx = 'zigorou';

my $auth = WebService::Windows::LiveID::Auth->new({
  appid => $appid,
  secret_key => $secret_key
});

my $user = eval { $auth->process_token($q->param("stoken"), $appctx); };
print $q->header;

unless ($@) {
  print "<p>Login sucsess.</p>\n";
  print "<p>uid: " . $user->uid . "</p>";
}
else {
  print "<p>Login failed.</p>";
}

METHODS

new($arguments)

Constructor. $arguments must be HASH reference.

## Constructor parameter sample.
$arguments = {
  appid => '00163FFF80003203', ## required
  secret_key => 'ApplicationKey123', ## required
  algorithm => 'wsignin1.0' ## optional
};

process_token($stoken, $appctx)

Process and validate stoken value. If the authentication is sucsess, then this method will return WebService::Windows::LiveID::Auth::User object. On fail, return undef value.

control_url([$query])

Return control url as URI::http object. $query parameter is optional, It must be HASH reference.

## query parameter sample
$query = {
  appctx => "zigorou",
  style => "font-family: Times Roman;"
};

Or

$query = {
  appctx => "zigorou",
  style => {
    "font-family" => "Verdana",
    "color" => "Grey"
  }
}

The "style" property allows SCALAR and HASH reference.

sign_in_url([$query])

Return sign-in url as URI::http object. $query parameter is optional, It must be HASH reference.

## query parameter sample
$query = {
  appctx => "zigorou"
};

sign_out_url()

Return sign-out url as URI::http object.

appid([$appid])

Application ID

algorithm([$algorithm])

Algorithm name

secret_key([$secret_key])

Secret key

sign_key()

Signature key.

crypt_key()

Encryption key

SEE ALSO

http://go.microsoft.com/fwlink/?linkid=92886
http://msdn2.microsoft.com/en-us/library/bb676626.aspx
http://dev.live.com/blogs/liveid/archive/2006/05/18/8.aspx
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=646&SiteID=1
http://www.microsoft.com/downloads/details.aspx?FamilyId=8BA187E5-3630-437D-AFDF-59AB699A483D&displaylang=en
http://msdn2.microsoft.com/en-us/library/bb288408.aspx
Crypt::Rijndael
Digest::SHA
MIME::Base64
URI::Escape

AUTHOR

Toru Yamaguchi, <zigorou@cpan.org>

BUGS

Please report any bugs or feature requests to bug-webservice-windows-liveid-auth@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2007 Toru Yamaguchi, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.