Class AssertionSupplierFactoryTest
java.lang.Object
org.apache.kafka.common.security.oauthbearer.internals.secured.OAuthBearerTest
org.apache.kafka.common.security.oauthbearer.internals.secured.assertion.AssertionSupplierFactoryTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidWhenSASL_OAUTHBEARER_ASSERTION_FILEis configured, the factory should use file-based assertion creation and return the JWT from the file.voidWhen the passphrase config key is absent, the factory should not attempt to read a password and should produce a working supplier with the unencrypted private key.voidWhen a passphrase is configured, the factory should read it viavalidatePasswordand pass it to theDefaultAssertionCreator.voidWhen no assertion file is configured, the factory should fall back to locally-generated assertions using the private key and signing algorithm.voidWhen static claims (aud, iss, sub) are configured alongside the private key, they should be included in the generated JWT assertion.voidWhen ES256 algorithm is configured, the factory should produce valid assertions signed with the EC private key.voidThe file-based supplier should return the same value on consecutive calls since the file contents haven't changed.voidThe locally-generated supplier should produce valid assertions on consecutive calls.voidAfter closing the supplier, the underlying resources should be released.voidClosing the supplier should not throw any exceptions.voidWhen the underlying file is deleted after factory creation, calling get() should throw a JwtRetrieverException since the assertion creator cannot read the file.
-
Constructor Details
-
AssertionSupplierFactoryTest
public AssertionSupplierFactoryTest()
-
-
Method Details
-
testCreateWithAssertionFile
-
testCreateWithPrivateKeyFile
-
testCreateWithPrivateKeyFileAndStaticClaims
-
testCreateWithPassphraseReadsPasswordConfig
When a passphrase is configured, the factory should read it viavalidatePasswordand pass it to theDefaultAssertionCreator. Providing a passphrase for an unencrypted key is an invalid combination and should result in aJwtRetrieverExceptionbecause the raw key bytes cannot be parsed as anEncryptedPrivateKeyInfostructure.- Throws:
Exception
-
testCreateWithoutPassphraseDoesNotReadPasswordConfig
-
testFileBasedSupplierReturnsSameValueOnMultipleCalls
-
testLocallyGeneratedSupplierProducesConsistentAssertions
-
testSupplierGetWrapsExceptionInJwtRetrieverException
-
testSupplierCloseDoesNotThrow
-
testSupplierCanBeClosedMultipleTimes
-
testCreateWithPrivateKeyFileEs256
-