Skip to content

Commit

Permalink
feat: Change pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzo-ingenito committed Dec 12, 2024
1 parent 6e0a6b9 commit c8ad740
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public Map<String, Object> consumerConfigs() {
props.put("sasl.login.callback.handler.class", CustomAuthenticateCallbackHandler.class);
props.put("kafka.oauth.tenantId", kafkaPropsCfg.getTenantId());
props.put("kafka.oauth.appId", kafkaPropsCfg.getAppId());
props.put("kafka.oauth.pfxName", kafkaPropsCfg.getPfxName());
props.put("kafka.oauth.pfxPathName", kafkaPropsCfg.getPfxPathName());
props.put("kafka.oauth.pwd", kafkaPropsCfg.getPwd());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Map<String, Object> producerWithoutTransactionConfigs() {
props.put("sasl.login.callback.handler.class", CustomAuthenticateCallbackHandler.class);
props.put("kafka.oauth.tenantId", kafkaPropCFG.getTenantId());
props.put("kafka.oauth.appId", kafkaPropCFG.getAppId());
props.put("kafka.oauth.pfxName", kafkaPropCFG.getPfxName());
props.put("kafka.oauth.pfxPathName", kafkaPropCFG.getPfxPathName());
props.put("kafka.oauth.pwd", kafkaPropCFG.getPwd());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class KafkaPropertiesCFG {
@Value("${kafka.oauth.appId}")
private String appId;

@Value("${kafka.oauth.pfxName}")
private String pfxName;
@Value("${kafka.oauth.pfxPathName}")
private String pfxPathName;

@Value("${kafka.oauth.pwd}")
private String pwd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class CustomAuthenticateCallbackHandler implements AuthenticateCallbackHa

private String appId;

private String pfxName;
private String pfxPathName;

private String pwd;

Expand All @@ -63,7 +63,7 @@ public void configure(Map<String, ?> configs, String mechanism, List<AppConfigur
.build();
this.tenantId = "https://login.microsoftonline.com/"+ Arrays.asList(configs.get("kafka.oauth.tenantId")).get(0).toString();
this.appId = Arrays.asList(configs.get("kafka.oauth.appId")).get(0).toString();
this.pfxName = Arrays.asList(configs.get("kafka.oauth.pfxName")).get(0).toString();
this.pfxPathName = Arrays.asList(configs.get("kafka.oauth.pfxPathName")).get(0).toString();
this.pwd = Arrays.asList(configs.get("kafka.oauth.pwd")).get(0).toString();

}
Expand All @@ -89,7 +89,7 @@ private OAuthBearerToken getOAuthBearerToken() throws MalformedURLException, Int
synchronized(this) {
if (this.aadClient == null) {
IClientCredential credential = null;
try (FileInputStream certificato = new FileInputStream(new File(pfxName))) {
try (FileInputStream certificato = new FileInputStream(new File(pfxPathName))) {
credential = ClientCredentialFactory.createFromCertificate(certificato, this.pwd);
} catch(Exception ex) {
log.error("Error while try to crate credential from certificate");
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ kafka.statusmanager.topic=MDS-SA-0004_FU_001_STATUS
kafka.statusmanager.eds.topic=MDS-SA-0004_FU_002_STATUS
kafka.oauth.tenantId=${TENANT_ID}
kafka.oauth.appId=${APP_ID}
kafka.oauth.pfxName=${PFX_NAME_RESOURCE_PATH}
kafka.oauth.pfxPathName=${PFX_NAME_RESOURCE_PATH}
kafka.oauth.pwd=${PWD}
####### KAFKA DEAD LETTER #####################
kafka.statusmanager.deadletter.topic=MDS-SA-0004_FU_001_STATUS-DLT
Expand Down

0 comments on commit c8ad740

Please sign in to comment.