AnyEvent-MSN
view release on metacpan or search on metacpan
lib/AnyEvent/MSN.pm view on Meta::CPAN
#dd $header;
#p($packet =~ m[^(.+?)\r\n(.+)\r\n\r\n(.)$]s);
my ($p2p_action, $p2p_head, $p2p_body)
= ($packet =~ m[^(.+?)\r\n(.+)\r\n\r\n(.)$]s);
#dd $head, $p2p_action,
# AnyEvent::MSN::Protocol::__parse_msn_headers($p2p_head),
# $p2p_body;
#warn 'Data'
# XXX - trigger a callback of some sort
}
when ('Signal/P2P') { warn 'P2P' }
when ('Signal/ForceAbchSync') { }
when ('Signal/CloseIMWindow') { }
when ('Signal/MarkIMWindowRead') { }
when ('Signal/Turn') { };
when ('Signal/AudioMeta') { }
when ('Signal/AudioTunnel') { }
default {...}
}
}
sub _handle_packet_usr {
my ($s, $tid, $subtype, $_s, $policy, $nonce) = @_;
if ($subtype eq 'OK') {
# Sent after we send ADL command. Lastcommand in the logon?
}
elsif ($subtype eq 'SSO') {
my $x = 1;
my @tokens = map {
sprintf <<'TOKEN', $x++, $_->[0], $_->[1] } @{$s->SSOsites};
<wst:RequestSecurityToken Id="RST%d">
<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>
<wsp:AppliesTo>
<wsa:EndpointReference>
<wsa:Address>%s</wsa:Address>
</wsa:EndpointReference>
</wsp:AppliesTo>
<wsse:PolicyReference URI="%s"></wsse:PolicyReference>
</wst:RequestSecurityToken>
TOKEN
$s->_soap_request(
($s->passport =~ m[\@msn.com$]i
?
'https://msnia.login.live.com/pp550/RST.srf'
: 'https://login.live.com/RST.srf'
),
{}, # headers
sprintf(<<'XML', $s->password, $s->passport, join '', @tokens),
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:wsu="http://docs.o...
<Header>
<wsse:Security>
<wsse:UsernameToken Id="user">
<wsse:Password>%s</wsse:Password>
<wsse:Username>%s</wsse:Username>
</wsse:UsernameToken>
</wsse:Security>
<ps:AuthInfo Id="PPAuthInfo" xmlns:ps="http://schemas.microsoft.com/Passport/SoapServices/PPCRL">
<ps:Cookies></ps:Cookies>
<ps:UIVersion>1</ps:UIVersion>
<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>
<ps:BinaryVersion>4</ps:BinaryVersion>
<ps:RequestParams>AQAAAAIAAABsYwQAAAAxMDMz</ps:RequestParams>
</ps:AuthInfo>
</Header>
<Body>
<ps:RequestMultipleSecurityTokens Id="RSTS" xmlns:ps="http://schemas.microsoft.com/Passport/SoapServices/PPCRL">
%s </ps:RequestMultipleSecurityTokens>
</Body>
</Envelope>
XML
sub {
my $d = shift;
for my $token (
@{ $d->{'S:Body'}
{'wst:RequestSecurityTokenResponseCollection'}
{'wst:RequestSecurityTokenResponse'}
}
)
{ $s->_add_auth_token(
$token->{'wsp:AppliesTo'}{'wsa:EndpointReference'}
{'wsa:Address'},
$token
);
}
#
if ($policy =~ m[MBI]) {
my $token = $s->auth_token('messengerclear.live.com')
; # or http://Passport.NET/tb
my $token_
= __html_escape($token->{'wst:RequestedSecurityToken'}
{'wsse:BinarySecurityToken'}{'content'});
$s->send('USR %d SSO S %s %s %s',
$s->tid,
$token->{'wst:RequestedSecurityToken'}
{'wsse:BinarySecurityToken'}{'content'},
AnyEvent::MSN::Protocol::SSO(
$nonce,
$token->{'wst:RequestedProofToken'}
{'wst:BinarySecret'}
),
$s->guid
);
}
elsif ($policy =~ m[^\?]) {
...;
}
}
);
}
elsif ($subtype eq 'OK') {
# XXX - logged in okay. What now?
}
else {
...;
}
}
( run in 0.837 second using v1.01-cache-2.11-cpan-39bf76dae61 )