static TestUtilities() { #pragma warning disable 618 IPublicKeyDataProvider publicKeyDataProvider = new InMemoryPublicKeyDataProvider(); #pragma warning restore 618 m_signer = EcDsaTokenSignerFactory .Create(publicKeyDataProvider, EcDsaTokenSignerFactory.Curve.P256); IAccessTokenValidator accessTokenValidator = AccessTokenValidatorFactory .CreateLocalValidator(publicKeyDataProvider); RequestAuthenticator = RequestAuthenticatorFactory.Create(accessTokenValidator); }
IRequestAuthenticator IFactory <IRequestAuthenticator> .Create() { // TODO: // - This blocking sucks but will disappear once IConfigViewer is taken rather than the actual endpoint // - We need these classes from the auth library to behave like singletons but get the auth endpoint dynamically from IConfigViewer // - This config should usually be fetched as a tenant config... when we support non-tenant access tokens we can switch config type inside the auth library ConfigValue <Uri> authEndpoint = m_configViewer .GetGlobalAsync <Uri>(Constants.Configs.AUTH_ENDPOINT) .SafeWait(); var accessTokenValidator = AccessTokenValidatorFactory.CreateRemoteValidator( new HttpClient(), // TODO: get rid of AccessTokenValidatorFactory (maybe), make AccessTokenValidatorFactory take an IHttpClientFactory authEndpoint.Value // TODO: AccessTokenValidator should take an IConfigViewer ); var requestAuthenticator = RequestAuthenticatorFactory.Create( accessTokenValidator: accessTokenValidator ); return(requestAuthenticator); }