// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Framework.Internal;
using Newtonsoft.Json.Linq;
namespace Microsoft.AspNet.Authentication.MicrosoftAccount
{
///
/// Contains static methods that allow to extract user's information from a
/// instance retrieved from Google after a successful authentication process.
///
public static class MicrosoftAccountHelper
{
///
/// Gets the Microsoft Account user ID.
///
public static string GetId([NotNull] JObject user) => user.Value("id");
///
/// Gets the user's name.
///
public static string GetName([NotNull] JObject user) => user.Value("name");
///
/// Gets the user's first name.
///
public static string GetFirstName([NotNull] JObject user) => user.Value("first_name");
///
/// Gets the user's last name.
///
public static string GetLastName([NotNull] JObject user) => user.Value("last_name");
///
/// Gets the user's email address.
///
public static string GetEmail([NotNull] JObject user) => user.Value("emails")
?.Value("preferred");
}
}