public static string AssertionForEmailAndSite(string email, Uri site) { IList<string> key = new AList<string>(); key.AddItem(email); key.AddItem(site.ToExternalForm().ToLower()); Log.D(Database.Tag, "PersonaAuthorizer looking up key: " + key + " from list of assertions" ); return assertions.Get(key); }
public static string AccessTokenForEmailAndSite(string email, Uri site) { try { IList<string> key = new AList<string>(); key.AddItem(email); key.AddItem(site.ToExternalForm().ToLower()); Log.D(Database.Tag, "FacebookAuthorizer looking up key: " + key + " from list of access tokens" ); return accessTokens.Get(key); } catch (Exception e) { Log.E(Database.Tag, "Error looking up access token", e); } return null; }
public static string RegisterAssertion(string assertion) { lock (typeof(PersonaAuthorizer)) { string email; string origin; IDictionary<string, object> result = ParseAssertion(assertion); email = (string)result.Get(AssertionFieldEmail); origin = (string)result.Get(AssertionFieldOrigin); // Normalize the origin URL string: try { Uri originURL = new Uri(origin); if (origin == null) { throw new ArgumentException("Invalid assertion, origin was null"); } origin = originURL.ToExternalForm().ToLower(); } catch (UriFormatException e) { string message = "Error registering assertion: " + assertion; Log.E(Database.Tag, message, e); throw new ArgumentException(message, e); } return RegisterAssertion(assertion, email, origin); } }
/// <exception cref="System.UriFormatException"></exception> private void VerifyRemoteDocExists(Uri remote, string doc1Id) { Uri replicationUrlTrailing = new Uri(string.Format("%s/", remote.ToExternalForm() )); Uri pathToDoc = new Uri(replicationUrlTrailing, doc1Id); Log.D(Tag, "Send http request to " + pathToDoc); CountDownLatch httpRequestDoneSignal = new CountDownLatch(1); BackgroundTask getDocTask = new _BackgroundTask_331(pathToDoc, doc1Id, httpRequestDoneSignal ); //Closes the connection. getDocTask.Execute(); Log.D(Tag, "Waiting for http request to finish"); try { httpRequestDoneSignal.Await(300, TimeUnit.Seconds); Log.D(Tag, "http request finished"); } catch (Exception e) { Sharpen.Runtime.PrintStackTrace(e); } }