public void Authenticate( IRestClient client, IRestRequest request ) { if ( HasFedAuthCookie( client ) ) return; client.CookieContainer = client.CookieContainer ?? new CookieContainer(); var auth = new InnerAuthenticator( ); // An unauthenticated request attempt to the resource should redirect us to the STS var stsLoginUri = auth.AttemptRequestAndGetStsLoginUri( request ); var authCookies = auth.SignInAndRetrieveFedAuthCookies( stsLoginUri ); client.CookieContainer.Add( new Uri( client.BaseUrl ), authCookies ); }
public void Authenticate(IRestClient client, IRestRequest request) { if (HasFedAuthCookie(client)) { return; } client.CookieContainer = client.CookieContainer ?? new CookieContainer(); var auth = new InnerAuthenticator( ); // An unauthenticated request attempt to the resource should redirect us to the STS var stsLoginUri = auth.AttemptRequestAndGetStsLoginUri(request); var authCookies = auth.SignInAndRetrieveFedAuthCookies(stsLoginUri); client.CookieContainer.Add(new Uri(client.BaseUrl), authCookies); }