public ClientAssertionJwtFactoryTests() { _tokenEndpointUri = "https://localhost/oauth2/token"; _clientId = "test_client"; _certificate = TestCertificate.Load(); _factory = new ClientAssertionJwtFactory(_tokenEndpointUri, _clientId, _certificate); }
/// <summary> /// Creates new JwtBearerClientAssertionCredentials /// </summary> /// <param name="tokenEndpointUri">OAuth2 token endpoint URI. Used as "aud" claim value</param> /// <param name="clientId">OAuth2 "client_id"</param> /// <param name="certificate">Certificate with private key. Certificate must be signed with SHA256. RSA keys must be 2048 bits long. Certificate must be associated with the client_id on the server</param> public JwtBearerClientAssertionCredentials(string tokenEndpointUri, string clientId, X509Certificate2 certificate) { ValidateCertificate(certificate); _assertionFactory = new ClientAssertionJwtFactory(tokenEndpointUri, clientId, certificate); CredentialThumbprint = (tokenEndpointUri + clientId + certificate.Thumbprint).Sha1Hex(); }