コード例 #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);
            }
        }
コード例 #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.
        }
コード例 #3
0
ファイル: AuditTests.cs プロジェクト: smartpcr/fhir-server
        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);
            }
        }
コード例 #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);
 }
コード例 #5
0
 private void ValidateExecutingAuditEntry(AuditEntry auditEntry, string expectedAction, Uri expectedUri, string expectedCorrelationId)
 {
     ValidateAuditEntry(auditEntry, AuditAction.Executing, expectedAction, null, expectedUri, null, expectedCorrelationId);
 }
コード例 #6
0
ファイル: AuditTests.cs プロジェクト: stvb/fhir-server
 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);
 }
コード例 #7
0
ファイル: AuditTests.cs プロジェクト: stvb/fhir-server
 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);
 }