6K Star 11.8K Fork 4K

GVPdotNET China / Furion

 / 详情

Furion Token刷新

已完成
成员
创建于  
2020-12-16 08:46

问题描述

刷新Token

评论 (2)

三重门 创建了任务
三重门 关联仓库设置为百小僧/Furion
百小僧 任务状态待办的 修改为进行中
百小僧 负责人设置为百小僧
百小僧 添加了
 
新功能
标签
百小僧 里程碑设置为Furion 2020
百小僧 关联分支设置为master
百小僧 计划截止日期设置为2020-12-17
百小僧 计划开始日期设置为2020-12-16
百小僧 置顶等级设置为
百小僧 优先级设置为严重
展开全部操作日志

参考关键代码:

var claims = new List<Claim>
    {
        new Claim(ClaimTypes.Name, "Wangdachui"),
        new Claim(ClaimTypes.NameIdentifier,"1"),
        new Claim(ClaimTypes.Role,"1")
    };
 
    //var claimIdentity = new ClaimsIdentity(claims, "Client1"); //ok
    //var claimIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);//ok
    var claimIdentity = new ClaimsIdentity("Cookie");//ok
 
    claimIdentity.AddClaim(new Claim("UserName", "Wangdachui"));
    claimIdentity.AddClaim(new Claim("Password", "123456"));
    claimIdentity.AddClaim(new Claim("RememberMe", "on"));
    claimIdentity.AddClaim(new Claim(ClaimTypes.Name, "刘德华"));
    claimIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "1"));
    claimIdentity.AddClaim(new Claim(ClaimTypes.Sid, "1"));
    claimIdentity.AddClaim(new Claim(ClaimTypes.Role, "1"));
 
    var claimsPrincipal = new ClaimsPrincipal(claimIdentity);

    HttpContext.User = claimsPrincipal;
三重门 任务状态进行中 修改为已完成
三重门 置顶等级 修改为不置顶
百小僧 任务状态已完成 修改为进行中
百小僧 通过 dotnetchina/Furion Commit 7d77fd9任务状态进行中 修改为已完成
// 手动刷新
var refreshToken = JWTEncryption.GenerateRefreshToken(output.AccessToken);
var newToken = JWTEncryption.Exchange(output.AccessToken, refreshToken);

// JWT 中配置

/// <summary>
        /// 授权
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override async Task HandleAsync(AuthorizationHandlerContext context)
        {
            if (JWTEncryption.AutoRefreshToken(context, context.GetCurrentHttpContext()))
            {
                await base.AuthorizeHandleAsync(context);
            }
        }
百小僧 关联分支master 修改为未关联

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
974299 monksoul 1578937227 1722306 zero530 1578958528
C#
1
https://gitee.com/dotnetchina/Furion.git
git@gitee.com:dotnetchina/Furion.git
dotnetchina
Furion
Furion

搜索帮助