protected static string GetIdentity(APIGatewayProxyRequest request)
        {
            Log.Debug("Checking Identity...");
            var identity = request.GetAuthorization();

            Validate.Begin()
            .IsNotNull(identity, "identity is null. Ensure the Authorization header is set.").Check()
            .IsNotEmpty(identity, "identity is null").Check();
            return(identity);
        }
        public void Authorization_NoAuthorizationHeader()
        {
            var headers = new Dictionary <string, string> {
                { "A Different Header", "boo!" }
            };
            var request = new APIGatewayProxyRequest {
                Headers = headers
            };

            request.GetAuthorization().Should().BeNullOrEmpty();
        }
        public void Authorization_Found()
        {
            var headers = new Dictionary <string, string> {
                { ApiGatewayProxyRequestExtensions.Authorization, "auth" }
            };
            var request = new APIGatewayProxyRequest {
                Headers = headers
            };

            request.GetAuthorization().Should().Be("auth");
        }
        public void Authorization_NoHeaders()
        {
            var request = new APIGatewayProxyRequest();

            request.GetAuthorization().Should().BeNullOrEmpty();
        }