/// <summary> /// Instantiates a credential from type information and subsequently /// calls <see cref="ReadCookieXml"/> to initialize the object. /// </summary> /// /// <param name="credNav"></param> /// /// <returns> /// An instance of <see cref="Credential"/>. /// </returns> /// internal static Credential CreateFromCookieXml(XPathNavigator credNav) { Credential cred = null; // expected schema: // <type>object Type</type> // <[credname]>...</[credname]> XPathNavigator typeNav = credNav.SelectSingleNode("type"); if (typeNav != null) { switch (typeNav.Value) { case "Microsoft.Health.Authentication.PassportCredential": cred = new PassportCredential(); break; case "Microsoft.Health.Web.Authentication.WebApplicationCredential": cred = new WebApplicationCredential(); break; default: return null; } typeNav.MoveToFollowing(XPathNodeType.Element); XmlReader reader = typeNav.ReadSubtree(); reader.Read(); cred.ReadCookieXml(reader); } return cred; }
/// <summary> /// Creates a new instance of a PassportCredential. /// </summary> /// /// <param name="appId"> /// A GUID representing the application identifier. /// </param> /// /// <remarks> /// A new instance of a PassportCredential is created by first /// calling into the Passport APIs and getting a ticket from the /// Passport service for the person logging on. Once the ticket has /// been verified by the Shell, it passes it to HealthVault to create /// the session token. /// </remarks> /// internal static PassportCredential Create(Guid appId) { PassportCredential cred = new PassportCredential(appId); cred.GetToken(); return cred; }