Mercurial > pidgin
diff libpurple/protocols/msn/nexus.h @ 23468:1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
also uses a callback to signify that the token has been updated.
Note: The updating does not actually work yet, but this commit is so
that the next two updates will compile.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 07 Jun 2008 06:08:01 +0000 |
parents | 72aa2ccad28d |
children | 9fdf0accd4aa |
line wrap: on
line diff
--- a/libpurple/protocols/msn/nexus.h Sat Jun 07 04:32:25 2008 +0000 +++ b/libpurple/protocols/msn/nexus.h Sat Jun 07 06:08:01 2008 +0000 @@ -95,6 +95,96 @@ "</Body>"\ "</Envelope>" +#define MSN_SSO_AUTHINFO_TEMPLATE \ +"<ps:AuthInfo xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"PPAuthInfo\">"\ + "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>"\ + "<ps:BinaryVersion>4</ps:BinaryVersion>"\ + "<ps:UIVersion>1</ps:UIVersion>"\ + "<ps:Cookies></ps:Cookies>"\ + "<ps:RequestParams>AQAAAAIAAABsYwQAAAA0MTA1</ps:RequestParams>"\ +"</ps:AuthInfo>" +/* Not sure what's editable here, so I'll just hard-code the SHA1 hash */ +#define MSN_SSO_AUTHINFO_SHA1_BASE64 "d2IeTF4DAkPEa/tVETHznsivEpc=" + +#define MSN_SSO_TIMESTAMP_TEMPLATE \ +"<wsu:Timestamp Id=\"Timestamp\">"\ + "<wsu:Created>%s</wsu:Created>"\ + "<wsu:Expires>%s</wsu:Expires>"\ +"</wsu:Timestamp>" + +#define MSN_SSO_SIGNEDINFO_TEMPLATE \ +"<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">"\ + "<CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></CanonicalizationMethod>"\ + "<SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#hmac-sha1\"></SignatureMethod>"\ + "<Reference URI=\"#RST0\">"\ + "<Transforms>"\ + "<Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></Transform>"\ + "</Transforms>"\ + "<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod>"\ + "<DigestValue>%s</DigestValue>"\ + "</Reference>"\ + "<Reference URI=\"#Timestamp\">"\ + "<Transforms>"\ + "<Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></Transform>"\ + "</Transforms>"\ + "<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod>"\ + "<DigestValue>%s</DigestValue>"\ + "</Reference>"\ + "<Reference URI=\"#PPAuthInfo\">"\ + "<Transforms>"\ + "<Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></Transform>"\ + "</Transforms>"\ + "<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod>"\ + "<DigestValue>" MSN_SSO_AUTHINFO_SHA1_BASE64 "</DigestValue>"\ + "</Reference>"\ +"</SignedInfo>" + +#define MSN_SSO_TOKEN_UPDATE_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ +"<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.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\""\ + " xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\""\ + " xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\""\ + " xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">"\ + "<Header>"\ + MSN_SSO_AUTHINFO_TEMPLATE /* ps:AuthInfo */ \ + "<wsse:Security>"\ + "<EncryptedData xmlns=\"http://www.w3.org/2001/04/xmlenc#\" Id=\"BinaryDAToken0\" Type=\"http://www.w3.org/2001/04/xmlenc#Element\">"\ + "<EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#tripledes-cbc\"></EncryptionMethod>"\ + "<ds:KeyInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">"\ + "<ds:KeyName>http://Passport.NET/STS</ds:KeyName>"\ + "</ds:KeyInfo>"\ + "<CipherData>"\ + "<CipherValue>%s</CipherValue>"\ + "</CipherData>"\ + "</EncryptedData>"\ + "<wssc:DerivedKeyToken Id=\"SignKey\">"\ + "<wsse:RequestedTokenReference>"\ + "<wsse:KeyIdentifier ValueType=\"http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID\" />"\ + "<wsse:Reference URI=\"#BinaryDAToken0\" />"\ + "</wsse:RequestedTokenReference>"\ + "<wssc:Nonce>%s</wssc:Nonce>"\ + "</wssc:DerivedKeyToken>"\ + "%s" /* wsu:Timestamp */\ + "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\">"\ + "%s" /* SignedInfo */\ + "<SignatureValue>%s</SignatureValue>"\ + "<KeyInfo>"\ + "<wsse:SecurityTokenReference>"\ + "<wsse:Reference URI=\"#SignKey\" />"\ + "</wsse:SecurityTokenReference>"\ + "</KeyInfo>"\ + "</Signature>"\ + "</wsse:Security>"\ + "</Header>"\ + "<Body>"\ + "%s" /* wst:RequestSecurityToken */ \ + "</Body>"\ +"</Envelope>" + typedef struct _MsnUsrKey MsnUsrKey; struct _MsnUsrKey { @@ -123,9 +213,14 @@ struct _MsnNexus { MsnSession *session; + + /* From server via USR command */ char *policy; char *nonce; + /* From server via SOAP stuff */ + char *cipher; + char *secret; MsnTicketToken *tokens; int token_len; }; @@ -133,8 +228,8 @@ void msn_nexus_connect(MsnNexus *nexus); MsnNexus *msn_nexus_new(MsnSession *session); void msn_nexus_destroy(MsnNexus *nexus); -GHashTable *msn_nexus_get_token(MsnNexus *session, MsnAuthDomains id); -const char *msn_nexus_get_token_str(MsnNexus *session, MsnAuthDomains id); - +GHashTable *msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id); +const char *msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id); +void msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data); #endif /* _MSN_NEXUS_H_ */