Esempio n. 1
0
        private void ValidateAuditEntry(AuditEntry auditEntry, AuditAction expectedAuditAction, string expectedAction, ResourceType?expectedResourceType, Uri expectedUri, HttpStatusCode?expectedStatusCode, string expectedCorrelationId, string expectedClaimValue, string expectedClaimKey)
        {
            Assert.NotNull(auditEntry);
            Assert.Equal(expectedAuditAction, auditEntry.AuditAction);
            Assert.Equal(expectedAction, auditEntry.Action);
            Assert.Equal(expectedResourceType?.ToString(), auditEntry.ResourceType);
            Assert.Equal(expectedUri, auditEntry.RequestUri);
            Assert.Equal(expectedStatusCode, auditEntry.StatusCode);
            Assert.Equal(expectedCorrelationId, auditEntry.CorrelationId);

            // Unfortunately, we cannot test the caller IP because these tests only run in-process, which does not go through network.

            if (expectedClaimValue != null)
            {
                Assert.Collection(
                    auditEntry.CallerClaims,
                    claim =>
                {
                    Assert.Equal(expectedClaimKey, claim.Key);
                    Assert.Equal(expectedClaimValue, claim.Value);
                });
            }
            else
            {
                Assert.Empty(auditEntry.CallerClaims);
            }
        }
Esempio n. 2
0
        private void ValidateAuditEntry(AuditEntry auditEntry, AuditAction expectedAuditAction, string expectedAction, ResourceType?expectedResourceType, Uri expectedUri, HttpStatusCode?expectedStatusCode, string expectedCorrelationId)
        {
            Assert.NotNull(auditEntry);
            Assert.Equal(expectedAuditAction, auditEntry.AuditAction);
            Assert.Equal(expectedAction, auditEntry.Action);
            Assert.Equal(expectedResourceType?.ToString(), auditEntry.ResourceType);
            Assert.Equal(expectedUri, auditEntry.RequestUri);
            Assert.Equal(expectedStatusCode, auditEntry.StatusCode);
            Assert.Equal(expectedCorrelationId, auditEntry.CorrelationId);

            // TODO: Currently, claims are not being generated in the integration test environment and therefore we are not testing it until we add support for custom claim in IdentityServer.
        }
Esempio n. 3
0
        private void ValidateAuditEntry(AuditEntry auditEntry, AuditAction expectedAuditAction, string expectedAction, ResourceType?expectedResourceType, Uri expectedUri, HttpStatusCode?expectedStatusCode, string expectedCorrelationId, string expectedClaimValue, string expectedClaimKey)
        {
            Assert.NotNull(auditEntry);
            Assert.Equal(expectedAuditAction, auditEntry.AuditAction);
            Assert.Equal(expectedAction, auditEntry.Action);
            Assert.Equal(expectedResourceType?.ToString(), auditEntry.ResourceType);
            Assert.Equal(expectedUri, auditEntry.RequestUri);
            Assert.Equal(expectedStatusCode, auditEntry.StatusCode);
            Assert.Equal(expectedCorrelationId, auditEntry.CorrelationId);

            if (expectedClaimValue != null)
            {
                Assert.Equal(1, auditEntry.Claims.Count);
                Assert.Equal(expectedClaimKey, auditEntry.Claims.Single().Key);
                Assert.Equal(expectedClaimValue, auditEntry.Claims.Single().Value);
            }
            else
            {
                Assert.Empty(auditEntry.Claims);
            }
        }
Esempio n. 4
0
 private void ValidateExecutedAuditEntry(AuditEntry auditEntry, string expectedAction, ResourceType?expectedResourceType, Uri expectedUri, HttpStatusCode?expectedStatusCode, string expectedCorrelationId)
 {
     ValidateAuditEntry(auditEntry, AuditAction.Executed, expectedAction, expectedResourceType, expectedUri, expectedStatusCode, expectedCorrelationId);
 }
Esempio n. 5
0
 private void ValidateExecutingAuditEntry(AuditEntry auditEntry, string expectedAction, Uri expectedUri, string expectedCorrelationId)
 {
     ValidateAuditEntry(auditEntry, AuditAction.Executing, expectedAction, null, expectedUri, null, expectedCorrelationId);
 }
Esempio n. 6
0
 private void ValidateExecutedAuditEntry(AuditEntry auditEntry, string expectedAction, ResourceType?expectedResourceType, Uri expectedUri, HttpStatusCode?expectedStatusCode, string expectedCorrelationId, string expectedClaimValue, string expectedClaimKey, Dictionary <string, string> expectedCustomAuditHeaders = null)
 {
     ValidateAuditEntry(auditEntry, AuditAction.Executed, expectedAction, expectedResourceType, expectedUri, expectedStatusCode, expectedCorrelationId, expectedClaimValue, expectedClaimKey, expectedCustomAuditHeaders);
 }
Esempio n. 7
0
 private void ValidateExecutingAuditEntry(AuditEntry auditEntry, string expectedAction, Uri expectedUri, string expectedCorrelationId, string expectedClaimValue, string expectedClaimKey, Dictionary <string, string> expectedCustomAuditHeaders = null)
 {
     ValidateAuditEntry(auditEntry, AuditAction.Executing, expectedAction, null, expectedUri, null, expectedCorrelationId, expectedClaimValue, expectedClaimKey, expectedCustomAuditHeaders);
 }