Exemple #1
0
        public static LinkArg FromLinkAppToken(this LinkAppToken apptoken, Func <string, string> GetSecret)
        {
            var secret = GetSecret(apptoken.AppName);

            if (secret.IsNullOrEmpty())
            {
                return(default);
Exemple #2
0
        public static LinkAppToken ToLinkAppToken(this LinkArg arg, string secret)
        {
            List <Claim> list    = new List <Claim>();
            Claim        orderid = new Claim(LinkArg.LinkClaimType, arg.BillJson);

            list.Add(orderid);
            DefaultJwtPrincipalBuilder jwtBuilder = new DefaultJwtPrincipalBuilder(secret);
            var token = jwtBuilder.BuildToken(list);

            LinkAppToken pac = new LinkAppToken()
            {
                Token   = token,
                AppName = arg.AppName
            };

            return(pac);
        }