Hi,

Unfortunately, it is not possible to use SSO for the Gmail feed, you
will need the Google Apps password.

You can fetch https://mail.google.com/a/YOURDOMAIN/feed/atom to get
email list.

Here is a code sample to do this:

 using System;
 using System.IO;
 using System.Net;
 using System.Text;

 public class test {

   public static void Main(string[] args) {
     string username = "user";
     string domain = "domain.com";
     string password = "password";
WebClient client = new WebClient();
     byte[] bytes = Encoding.ASCII.GetBytes(username + "@" + domain +
":"
+
 password);
     client.Headers.Add("Authorization", "Basic " +
 Convert.ToBase64String(bytes));
     string gmailURI = " https://mail.google.com/a/"; + domain +
"/feed/atom";
StreamReader reader = new StreamReader(client.OpenRead(gmailURI));
     string feedAsXml = reader.ReadToEnd();
     reader.Close();
     Console.WriteLine(feedAsXml);
   }
 }

Cheers,
Julian.

On Jul 7, 10:16 am, hellstar <[EMAIL PROTECTED]> wrote:
> hi ,
>
> were using c#
>
> we want to connect to RSS and get the top 5 mails of a user ,
>
> we are using SSO to connect to the mail and send the login info.
>
> but we didnt succeed , so we though we will open an HttpWebRequest ,
> send the authentication data
> and connect to the SSO without forwarding the user to gmail page.
>
> but we ran into a lot of problems with sending the data
>
> the code we wrote is :
>
>  string strNewValue;
>             string strResponse;
>
>             strNewValue = "RelayState=" + RelayState.Value +
> "&SAMLResponse=" + SAMLResponse.Value;
>             byte[] v_byte =
> System.Text.Encoding.UTF8.GetBytes(strNewValue);
>             // Create the request obj
>             HttpWebRequest req =
> (HttpWebRequest)WebRequest.Create(ActionUrl);
>             // Set values for the request back
>             req.Method = "POST";
>             req.ContentType = "application/x-www-form-urlencoded"; //
> application/x-www-form-urlencoded
>             req.AllowAutoRedirect = true;
>             req.AllowWriteStreamBuffering = true;
>
>             req.ContentLength = strNewValue.Length;
>             // Write the request
>
>             Stream PostData = req.GetRequestStream();
>             PostData.Write(v_byte, 0, v_byte.Length);
>             PostData.Close();
>
>             // Do the request to get the response
>             StreamReader stIn = new
> StreamReader(req.GetResponse().GetResponseStream());
>             strResponse = stIn.ReadToEnd();
>             stIn.Close();
>
> The RelayState is :http://mail.google.com/a/Mydomain
>
> and the SAMLResponse is :
> <samlp:Response ID="nmooaoafnmodfamllegnjhbngalnjhmflikajocd"
> IssueInstant="2008-07-07T12:15:18Z" Version="2.0"
> xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
> xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" 
> xmlns:xenc="http://www.w3.org/2001/04/xmlenc#";>
> <Signature xmlns="http://www.w3.org/2000/09/
> xmldsig#"><SignedInfo><CanonicalizationMethod 
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; /><SignatureMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"; /><Reference
> URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/
> xmldsig#enveloped-signature" /></Transforms><DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"; /><DigestValue>3/HM/
> F6Tqj8TlElN6x+W+x3CjQc=</DigestValue></Reference></
> SignedInfo><SignatureValue>XPVLtJj9ZWcJLUASiaw16lkYLRJeUPM5q98wg9DuKOKvxKaYrsyytsrsvPhIKCK2Iv8tiwEdK7tXORmxNXwuTdb/
> TF9bSIKBdZnKi4Krgk/Mp/
> ym6HnlNuGMJuA5duMbuhBe0oSf6wq4AYQBmpqsn4sOdoWuAOIwhP3FfUx6me0=</
> SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>0LEumZW9kH3kBsnUvHftaEDri/
> JjQ+46LyWGPC6FYj86QsmCL1IbKoV8oj2QvF39V4H/ZhkQ0Fi
> +bOUXncONK5uRpJvML7jSs4HfPIJvxc8dMakS1+imu++RtxJ4BR4Hi3zi/
> bCBAqtGuWKJQJK7IO7SviCqw38zzpsW0RGyDUE=</Modulus><Exponent>AQAB</
> Exponent></RSAKeyValue></KeyValue></KeyInfo></
> Signature><samlp:Status><samlp:StatusCode
> Value="urn:oasis:names:tc:SAML:2.0:status:Success" /></
> samlp:Status><Assertion ID="liodloljaifkhidjjjgalepjhmfdepecnhpkbjgl"
> IssueInstant="2003-04-17T00:46:02Z" Version="2.0"
> xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><Issuer>https://www.opensaml.org/IDP
>     </Issuer><Subject><NameID Format="urn:oasis:names:tc:SAML:
> 1.1:nameid-format:emailAddress">raz</NameID><SubjectConfirmation
> Method="urn:oasis:names:tc:SAML:
> 2.0:cm:bearer"><SubjectConfirmationData 
> Recipient="https://www.google.com/a/gt.orange.co.il/acs";
> NotOnOrAfter="2008-07-07T09:25:18Z"
> InResponseTo="gmlmghhgoldgfjcnmbdmiplmlpifbgpidaffpnic" /></
> SubjectConfirmation></Subject><Conditions
> NotBefore="2008-07-07T09:10:18Z"
> NotOnOrAfter="2008-07-07T09:25:18Z"><AudienceRestriction><Audience>https://www.google.com/a/gt.orange.co.il/acs</Audience></AudienceRestriction></Conditions><AuthnStatement
> AuthnInstant="2008-07-07T12:15:18Z"><AuthnContext><AuthnContextClassRef>
>           urn:oasis:names:tc:SAML:2.0:ac:classes:Password
>         </AuthnContextClassRef></AuthnContext></AuthnStatement></
> Assertion></samlp:Response>
>
> can anyone tell me what the problem is , or how to do it correctly ?
>
> Thanks in advance,
> Jonathan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to