Exemplo n.º 1
0
        public void InitialTestContext()
        {
            if (CoreAppContext.Identity == null)
            {
                var appIdentity = new AppIdentity()
                {
                    tenant_id = "1",
                    app_id    = AppInfoHelper.AppId,
                    UDID      = "TestDevice",
                };
                //AppInfoHelper.FormatAppIdInfo(appIdentity);
                CoreAppContext.SetIdentity(appIdentity);
            }

            if (CoreUserContext.Identity == null)
            {
                var userIdentity = new UserIdentity()
                {
                    id        = userId,
                    auth_type = PortalAuthorizeType.Admin
                };

                CoreUserContext.SetIdentity(userIdentity);
            }
        }
Exemplo n.º 2
0
        private static async Task<Resp> FormatUserIdentity(AuthorizationFilterContext context, AppIdentity appInfo, UserAuthOption opt)
        {
            var identityRes = await opt.UserProvider.GetIdentity(context.HttpContext, appInfo);
            if (!identityRes.IsSuccess())
                return identityRes;

            CoreUserContext.SetIdentity(identityRes.data);
            return identityRes;
        }