/// <summary> /// Creates an IAccessTokenProvider with the supplied test credentials. /// </summary> /// <param name="httpClient">The httpClient that makes the request to the auth server</param> /// <param name="tokenProvisioningEndpoint">The auth server</param> /// <param name="keyId">The id of the security token</param> /// <param name="rsaParameters">The public and private key for the supplied key id</param> /// <returns>An IAccessTokenProvider with the supplied test credentials</returns> public static IAccessTokenProvider Create( HttpClient httpClient, String tokenProvisioningEndpoint, Guid keyId, RSAParameters rsaParameters ) { #pragma warning disable 618 IPrivateKeyProvider privateKeyProvider = new StaticPrivateKeyProvider( keyId, rsaParameters ); #pragma warning restore 618 ITokenSigner tokenSigner = new TokenSigner( privateKeyProvider ); IAuthServiceClient authServiceClient = new AuthServiceClient( httpClient, new Uri( tokenProvisioningEndpoint ) ); INonCachingAccessTokenProvider noCacheTokenProvider = new AccessTokenProvider( tokenSigner, authServiceClient ); return new CachedAccessTokenProvider( noCacheTokenProvider, Timeout.InfiniteTimeSpan ); }
/// <summary> /// Creates an IAccessTokenProvider with the supplied test credentials. /// </summary> /// <param name="httpClient">The httpClient that makes the request to the auth server</param> /// <param name="tokenProvisioningEndpoint">The auth server</param> /// <param name="keyId">The id of the security token</param> /// <param name="rsaParameters">The public and private key for the supplied key id</param> /// <returns>An IAccessTokenProvider with the supplied test credentials</returns> public static IAccessTokenProvider Create(HttpClient httpClient, String tokenProvisioningEndpoint, Guid keyId, RSAParameters rsaParameters) { #pragma warning disable 618 IPrivateKeyProvider privateKeyProvider = new StaticPrivateKeyProvider(keyId, rsaParameters); #pragma warning restore 618 ITokenSigner tokenSigner = new TokenSigner(privateKeyProvider); IAuthServiceClient authServiceClient = new AuthServiceClient(httpClient, new Uri(tokenProvisioningEndpoint)); INonCachingAccessTokenProvider noCacheTokenProvider = new AccessTokenProvider(tokenSigner, authServiceClient); return(new CachedAccessTokenProvider(noCacheTokenProvider, Timeout.InfiniteTimeSpan)); }