예제 #1
0
        public byte[] EncodeAsUtf8Bytes <T>(T payload, DateTimeOffset?expire, Action <T, JwtWriter> payloadWriter)
        {
            var buffer = GetWriter();

            try
            {
                var writer = new JwtWriter(buffer, signAlgorithm, expire);
                payloadWriter(payload, writer);
                return(buffer.ToUtf8Bytes());
            }
            finally
            {
                buffer.Reset();
            }
        }
예제 #2
0
        public string Encode <T>(T payload, DateTimeOffset?expire, Action <T, JwtWriter> payloadWriter)
        {
            var buffer = GetWriter();

            try
            {
                var writer = new JwtWriter(buffer, signAlgorithm, expire);
                payloadWriter(payload, writer);
                return(buffer.ToString());
            }
            finally
            {
                buffer.Reset();
            }
        }
예제 #3
0
        public void Encode <T>(IBufferWriter <byte> bufferWriter, T payload, DateTimeOffset?expire, Action <T, JwtWriter> payloadWriter)
        {
            var writer = new JwtWriter(bufferWriter, signAlgorithm, expire);

            payloadWriter(payload, writer);
        }