コード例 #1
0
        private async Task SetupAuthenticationAsync(TestApplication clientApplication, TestUser user = null)
        {
            if (SecurityEnabled == true)
            {
                var tokenKey = $"{clientApplication.ClientId}:{(user == null ? string.Empty : user.UserId)}";

                if (!_bearerTokens.ContainsKey(tokenKey))
                {
                    await Authenticate(clientApplication, user);

                    _bearerTokens[tokenKey] = HttpClient.DefaultRequestHeaders?.Authorization?.Parameter;
                }
                else
                {
                    SetBearerToken(_bearerTokens[tokenKey]);
                }
            }
        }
コード例 #2
0
 public TestFhirClient CreateClientForUser(TestUser user, TestApplication clientApplication)
 {
     EnsureArg.IsNotNull(user, nameof(user));
     EnsureArg.IsNotNull(clientApplication, nameof(clientApplication));
     return(_testFhirServer.GetTestFhirClient(Format, clientApplication, user));
 }