public string GetUserName(AuthResult authResult) { string userName = authResult.UserName; if (IsEmail(userName)) { return userName; } else { return userName + "@" + authResult.Provider; } }
public string GetEmail(AuthResult authResult) { string email = ""; if (IsEmail(authResult.UserName)) { email = authResult.UserName; } else { email = ""; if (authResult.ExtraData != null) { var extraData = new Dictionary<string, string>(authResult.ExtraData, StringComparer.OrdinalIgnoreCase); if (extraData.ContainsKey("email")) { email = extraData["email"]; } } } return email; }
static AuthResult() { Failed = new AuthResult(false); }