コード例 #1
0
        private void ProcessMetaData <T>(FunctionOutput <T> output)
        {
            var meta = output.MetaData;

            if (meta == null)
            {
                return;
            }

            if (meta.ContainsKey("resultType") &&
                meta["resultType"] is string s && s == RpcDataType.AuthTicket &&
                output.Result is JwtAuthorizationTicket ticket)
            {
                client.Configuration.AuthorizationTicketHolder.Ticket = ticket;
            }
        }
コード例 #2
0
        private void ProcessMetaData(FunctionOutput output)
        {
            var meta = output.MetaData;

            if (meta == null)
            {
                return;
            }

            if (meta.ContainsKey("resultType") &&
                meta["resultType"] is string s && s == RpcDataType.AuthTicket &&
                output.Result is JObject json &&
                json.ContainsKey("accessToken") && json.GetValue("accessToken")?.Value <string>() is { } accessToken&&
                json.ContainsKey("refreshToken") && json.GetValue("refreshToken")?.Value <string>() is { } refreshToken)
            {
                var ticket = new JwtAuthorizationTicket(accessToken, refreshToken);
                client.Configuration.AuthorizationTicketHolder.Ticket = ticket;
            }
        }