@@ -1977,6 +1977,7 @@ public void testOauthConfiguration() {
19771977 .withMaxSecondsWithoutReauthentication (3600 )
19781978 .withJwksMinRefreshPauseSeconds (5 )
19791979 .withEnablePlain (true )
1980+ .withClientGrantType ("custom_client_credentials" )
19801981 .withTokenEndpointUri ("http://token" )
19811982 .withConnectTimeoutSeconds (30 )
19821983 .withReadTimeoutSeconds (30 )
@@ -2012,9 +2013,9 @@ public void testOauthConfiguration() {
20122013 "ssl.endpoint.identification.algorithm=HTTPS" ,
20132014 "principal.builder.class=io.strimzi.kafka.oauth.server.OAuthKafkaPrincipalBuilder" ,
20142015 "listener.name.plain-9092.oauthbearer.sasl.server.callback.handler.class=io.strimzi.kafka.oauth.server.JaasServerOauthValidatorCallbackHandler" ,
2015- "listener.name.plain-9092.oauthbearer.sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required unsecuredLoginStringClaim_sub=\" thePrincipalName\" oauth.valid.issuer.uri=\" http://valid-issuer\" oauth.jwks.endpoint.uri=\" http://jwks\" oauth.jwks.refresh.min.pause.seconds=\" 5\" oauth.server.bearer.token.location=\" /var/run/secrets/kubernetes.io/serviceaccount/token\" oauth.username.claim=\" preferred_username\" oauth.username.prefix=\" user-\" oauth.fallback.username.claim=\" client_id\" oauth.fallback.username.prefix=\" service-account-\" oauth.groups.claim=\" $.groups\" oauth.groups.claim.delimiter=\" ;\" oauth.connect.timeout.seconds=\" 30\" oauth.read.timeout.seconds=\" 30\" oauth.enable.metrics=\" true\" oauth.include.accept.header=\" false\" oauth.config.id=\" PLAIN-9092\" ;" ,
2016+ "listener.name.plain-9092.oauthbearer.sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required unsecuredLoginStringClaim_sub=\" thePrincipalName\" oauth.valid.issuer.uri=\" http://valid-issuer\" oauth.client.credentials.grant.type= \" custom_client_credentials \" oauth. jwks.endpoint.uri=\" http://jwks\" oauth.jwks.refresh.min.pause.seconds=\" 5\" oauth.server.bearer.token.location=\" /var/run/secrets/kubernetes.io/serviceaccount/token\" oauth.username.claim=\" preferred_username\" oauth.username.prefix=\" user-\" oauth.fallback.username.claim=\" client_id\" oauth.fallback.username.prefix=\" service-account-\" oauth.groups.claim=\" $.groups\" oauth.groups.claim.delimiter=\" ;\" oauth.connect.timeout.seconds=\" 30\" oauth.read.timeout.seconds=\" 30\" oauth.enable.metrics=\" true\" oauth.include.accept.header=\" false\" oauth.config.id=\" PLAIN-9092\" ;" ,
20162017 "listener.name.plain-9092.plain.sasl.server.callback.handler.class=io.strimzi.kafka.oauth.server.plain.JaasServerOauthOverPlainValidatorCallbackHandler" ,
2017- "listener.name.plain-9092.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required oauth.valid.issuer.uri=\" http://valid-issuer\" oauth.jwks.endpoint.uri=\" http://jwks\" oauth.jwks.refresh.min.pause.seconds=\" 5\" oauth.server.bearer.token.location=\" /var/run/secrets/kubernetes.io/serviceaccount/token\" oauth.username.claim=\" preferred_username\" oauth.username.prefix=\" user-\" oauth.fallback.username.claim=\" client_id\" oauth.fallback.username.prefix=\" service-account-\" oauth.groups.claim=\" $.groups\" oauth.groups.claim.delimiter=\" ;\" oauth.connect.timeout.seconds=\" 30\" oauth.read.timeout.seconds=\" 30\" oauth.enable.metrics=\" true\" oauth.include.accept.header=\" false\" oauth.config.id=\" PLAIN-9092\" oauth.token.endpoint.uri=\" http://token\" ;" ,
2018+ "listener.name.plain-9092.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required oauth.valid.issuer.uri=\" http://valid-issuer\" oauth.client.credentials.grant.type= \" custom_client_credentials \" oauth. jwks.endpoint.uri=\" http://jwks\" oauth.jwks.refresh.min.pause.seconds=\" 5\" oauth.server.bearer.token.location=\" /var/run/secrets/kubernetes.io/serviceaccount/token\" oauth.username.claim=\" preferred_username\" oauth.username.prefix=\" user-\" oauth.fallback.username.claim=\" client_id\" oauth.fallback.username.prefix=\" service-account-\" oauth.groups.claim=\" $.groups\" oauth.groups.claim.delimiter=\" ;\" oauth.connect.timeout.seconds=\" 30\" oauth.read.timeout.seconds=\" 30\" oauth.enable.metrics=\" true\" oauth.include.accept.header=\" false\" oauth.config.id=\" PLAIN-9092\" oauth.token.endpoint.uri=\" http://token\" ;" ,
20182019 "listener.name.plain-9092.sasl.enabled.mechanisms=OAUTHBEARER,PLAIN" ,
20192020 "listener.name.plain-9092.connections.max.reauth.ms=3600000" ));
20202021 }
@@ -2037,6 +2038,7 @@ public void testOauthConfigurationWithPlainOnly() {
20372038 .withTokenEndpointUri ("http://token" )
20382039 .withClientAudience ("kafka" )
20392040 .withClientScope ("messaging" )
2041+ .withClientGrantType ("custom_client_credentials" )
20402042 .withConnectTimeoutSeconds (30 )
20412043 .withEnableMetrics (true )
20422044 .endKafkaListenerAuthenticationOAuth ()
@@ -2069,7 +2071,7 @@ public void testOauthConfigurationWithPlainOnly() {
20692071 "ssl.endpoint.identification.algorithm=HTTPS" ,
20702072 "principal.builder.class=io.strimzi.kafka.oauth.server.OAuthKafkaPrincipalBuilder" ,
20712073 "listener.name.plain-9092.plain.sasl.server.callback.handler.class=io.strimzi.kafka.oauth.server.plain.JaasServerOauthOverPlainValidatorCallbackHandler" ,
2072- "listener.name.plain-9092.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required oauth.valid.issuer.uri=\" http://valid-issuer\" oauth.scope=\" messaging\" oauth.audience=\" kafka\" oauth.jwks.endpoint.uri=\" http://jwks\" oauth.jwks.refresh.min.pause.seconds=\" 5\" oauth.username.claim=\" preferred_username\" oauth.connect.timeout.seconds=\" 30\" oauth.enable.metrics=\" true\" oauth.config.id=\" PLAIN-9092\" oauth.token.endpoint.uri=\" http://token\" ;" ,
2074+ "listener.name.plain-9092.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required oauth.valid.issuer.uri=\" http://valid-issuer\" oauth.client.credentials.grant.type= \" custom_client_credentials \" oauth. scope=\" messaging\" oauth.audience=\" kafka\" oauth.jwks.endpoint.uri=\" http://jwks\" oauth.jwks.refresh.min.pause.seconds=\" 5\" oauth.username.claim=\" preferred_username\" oauth.connect.timeout.seconds=\" 30\" oauth.enable.metrics=\" true\" oauth.config.id=\" PLAIN-9092\" oauth.token.endpoint.uri=\" http://token\" ;" ,
20732075 "listener.name.plain-9092.sasl.enabled.mechanisms=PLAIN" ,
20742076 "listener.name.plain-9092.connections.max.reauth.ms=3600000" ));
20752077 }
@@ -2252,6 +2254,7 @@ public void testOAuthOptions() {
22522254 .withReadTimeoutSeconds (60 )
22532255 .withHttpRetries (2 )
22542256 .withHttpRetryPauseMs (500 )
2257+ .withClientGrantType ("custom_client_credentials" )
22552258 .withClientAudience ("kafka" )
22562259 .withClientScope ("messaging" )
22572260 .withEnableMetrics (true )
@@ -2265,6 +2268,7 @@ public void testOAuthOptions() {
22652268 expectedOptions .put (ServerConfig .OAUTH_CHECK_ISSUER , String .valueOf (false ));
22662269 expectedOptions .put (ServerConfig .OAUTH_CHECK_AUDIENCE , String .valueOf (true ));
22672270 expectedOptions .put (ServerConfig .OAUTH_CUSTOM_CLAIM_CHECK , "@.aud && @.aud == 'something'" );
2271+ expectedOptions .put (ServerConfig .OAUTH_CLIENT_CREDENTIALS_GRANT_TYPE , "custom_client_credentials" );
22682272 expectedOptions .put (ServerConfig .OAUTH_SCOPE , "messaging" );
22692273 expectedOptions .put (ServerConfig .OAUTH_AUDIENCE , "kafka" );
22702274 expectedOptions .put (ServerConfig .OAUTH_JWKS_ENDPOINT_URI , "http://jwks-endpoint" );
0 commit comments