Beispiel #1
0
        public void AddPopToken_should_set_authorization_header()
        {
            var request = new HttpRequestMessage(HttpMethod.Post, "http://foo.com/bar");

            request.AddPopToken("token");

            request.Headers.Authorization.Should().NotBeNull();
            request.Headers.Authorization.Scheme.Should().Be("PoP");
            request.Headers.Authorization.Parameter.Should().Be("token");
        }
Beispiel #2
0
        public async Task ProcessSignatureAsync(HttpRequestMessage request)
        {
            var parameters = await _options.CreateEncodingParametersAsync(request);

            if (parameters != null)
            {
                Logger.Debug("Encoding parameters recieved; signing and adding pop token");

                var token = _signature.Sign(parameters);
                request.AddPopToken(token);
            }
            else
            {
                Logger.Debug("No encoding parameters recieved; not adding pop token");
            }
        }