using Furion;
using Nirvana.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YBDevice.NApi.Application.ThirdClient
{
///
/// 获取授权用户信息
///
public static class AuthUserInfoService
{
public static AuthUserInfo GetUserInfo()
{
AuthUserInfo CurrentUser = null;
var user = App.User;
if (user != null)
{
CurrentUser = new AuthUserInfo();
if (user.HasClaim(x => x.Type == "UserId"))
{
CurrentUser.UserId = user.FindFirst("UserId").Value.ToGuid();
}
if (user.HasClaim(x => x.Type == "OpenId"))
{
CurrentUser.OpenId = user.FindFirst("OpenId").Value.ToString();
}
}
return CurrentUser;
}
}
///
/// 授权用户信息
///
public class AuthUserInfo
{
///
/// 用户ID
///
public Guid UserId { get; set; }
///
/// 用户OPENID
///
public string OpenId { get; set; }
}
}