From daca6350c1997fd4c7a54d2bc9200828af11d07d Mon Sep 17 00:00:00 2001 From: vaibhav-a mankar Date: Fri, 28 Nov 2025 14:33:26 +0530 Subject: [PATCH 1/5] SYMPHONYP-1416 certificate-base-authentication-on-springbot --- .../AbstractTeamsConversations.java | 15 ++--- .../SpringBotMicrosoftAppCredentials.java | 67 +++++++++++++++++++ .../StateStorageBasedTeamsConversations.java | 3 +- .../TeamsConversationsConfig.java | 25 ++++--- 4 files changed, 92 insertions(+), 18 deletions(-) create mode 100644 libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java index 58b810be3..e5261f1a8 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java @@ -21,7 +21,6 @@ import com.microsoft.bot.builder.teams.TeamsInfo; import com.microsoft.bot.connector.ConnectorClient; import com.microsoft.bot.connector.Conversations; -import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials; import com.microsoft.bot.schema.Activity; import com.microsoft.bot.schema.ChannelAccount; import com.microsoft.bot.schema.ConversationAccount; @@ -40,11 +39,11 @@ */ public abstract class AbstractTeamsConversations implements TeamsConversations { - private MicrosoftAppCredentials mac; + private SpringBotMicrosoftAppCredentials mac; private BotFrameworkAdapter bfa; private ChannelAccount botAccount; - public AbstractTeamsConversations(BotFrameworkAdapter bfa, MicrosoftAppCredentials mac, ChannelAccount botAccount) { + public AbstractTeamsConversations(BotFrameworkAdapter bfa, SpringBotMicrosoftAppCredentials mac, ChannelAccount botAccount) { super(); this.mac = mac; this.bfa = bfa; @@ -145,7 +144,7 @@ protected String getOneToOneConversationId(TeamsUser tu) { try { ConversationParameters cp = new ConversationParameters(); cp.setIsGroup(false); - cp.setTenantId(mac.getChannelAuthTenant()); + cp.setTenantId(mac.getTenantId()); cp.setMembers(Collections.singletonList(new ChannelAccount(tu.getKey()))); return getConversations().createConversation(cp).get().getId(); @@ -159,17 +158,17 @@ public ConversationAccount getConversationAccount(TeamsAddressable address) { if (address instanceof TeamsUser) { String chatForUser = getOneToOneConversationId((TeamsUser) address); ConversationAccount ca = new ConversationAccount(chatForUser); - ca.setTenantId(mac.getChannelAuthTenant()); + ca.setTenantId(mac.getTenantId()); ca.setConversationType("personal"); return ca; } else if (address instanceof TeamsChannel) { ConversationAccount ca = new ConversationAccount(address.getKey()); - ca.setTenantId(mac.getChannelAuthTenant()); + ca.setTenantId(mac.getTenantId()); ca.setConversationType("channel"); return ca; } else if (address instanceof TeamsMultiwayChat) { ConversationAccount ca = new ConversationAccount(address.getKey()); - ca.setTenantId(mac.getChannelAuthTenant()); + ca.setTenantId(mac.getTenantId()); ca.setConversationType("groupChat"); return ca; } else { @@ -226,7 +225,7 @@ private TurnContext getWorkingTurnContext(TeamsAddressable ta) { TurnContext[] holder = new TurnContext[1]; - bfa.continueConversation(mac.getAppId(), createConversationReference(ta), tc -> { + bfa.continueConversation(mac.getClientId(), createConversationReference(ta), tc -> { holder[0] = tc; return CompletableFuture.completedFuture(null); }).get(); diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java new file mode 100644 index 000000000..4463566ef --- /dev/null +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java @@ -0,0 +1,67 @@ +package org.finos.springbot.teams.conversations; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Base64; + +import com.azure.core.credential.TokenRequestContext; +import com.azure.identity.ClientCertificateCredential; +import com.azure.identity.ClientCertificateCredentialBuilder; + +public class SpringBotMicrosoftAppCredentials { + + private String tenantId; + private String clientId; + private ClientCertificateCredential credential; + + public SpringBotMicrosoftAppCredentials(String tenantId, String clientId, String certificate, + String certificatePassword) { + this.tenantId = tenantId; + this.clientId = clientId; + String pemContent = certificate; + // Check for file extension and illegal path characters + boolean isFilePath = (certificate != null && (certificate.endsWith(".p12"))); + try { + if (!isFilePath) { + byte[] decode = Base64.getDecoder().decode(pemContent); + + java.nio.file.Path tempFile = Files.createTempFile("cert", ".p12"); + Files.write(tempFile, decode); + certificate = tempFile.toAbsolutePath().toString(); + } + + this.credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId) + .pemCertificate(Files.newInputStream(Paths.get(certificate))) + .clientCertificatePassword(certificatePassword).build(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("Failed to create certificate", e); + } + } + + public String getTenantId() { + return tenantId; + } + + public String getClientId() { + return clientId; + } + + public ClientCertificateCredential getCredential() { + return credential; + } + + public String getToken() { + // SOMETHING LIKE THIS + return credential.getTokenSync(new TokenRequestContext().addScopes("https://graph.microsoft.com/.default")) + .getToken(); + } + + public static InputStream stringToInputStream(String content) { + return new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); + } +} \ No newline at end of file diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java index 1a0562161..4db0cc83e 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java @@ -21,7 +21,6 @@ import org.finos.springbot.workflow.content.Chat; import com.microsoft.bot.builder.BotFrameworkAdapter; -import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials; import com.microsoft.bot.schema.ChannelAccount; public class StateStorageBasedTeamsConversations extends AbstractTeamsConversations { @@ -34,7 +33,7 @@ public class StateStorageBasedTeamsConversations extends AbstractTeamsConversati protected final TeamsStateStorage tss; - public StateStorageBasedTeamsConversations(BotFrameworkAdapter bfa, MicrosoftAppCredentials mac, + public StateStorageBasedTeamsConversations(BotFrameworkAdapter bfa, SpringBotMicrosoftAppCredentials mac, ChannelAccount botAccount, TeamsStateStorage tss) { super(bfa, mac, botAccount); this.tss = tss; diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java index 6fa6526ae..fbd155846 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java @@ -10,6 +10,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; +import com.azure.identity.ClientCertificateCredential; import com.microsoft.bot.builder.BotFrameworkAdapter; import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials; import com.microsoft.bot.integration.AdapterWithErrorHandler; @@ -19,24 +20,32 @@ public class TeamsConversationsConfig extends BotDependencyConfiguration { @Bean - public MicrosoftAppCredentials microsoftCredentials(@Value("${teams.app.tennantId}") String tennantId) { + public SpringBotMicrosoftAppCredentials microsoftCredentials(@Value("${teams.app.tennantId}") String tennantId) { com.microsoft.bot.integration.Configuration conf = getConfiguration(); - MicrosoftAppCredentials mac = new MicrosoftAppCredentials( - conf.getProperty(MicrosoftAppCredentials.MICROSOFTAPPID), - conf.getProperty(MicrosoftAppCredentials.MICROSOFTAPPPASSWORD), - tennantId); - return mac; + + String clientId = conf.getProperty(MicrosoftAppCredentials.MICROSOFTAPPID); + + SpringBotMicrosoftAppCredentials out = new SpringBotMicrosoftAppCredentials(tennantId, + clientId, conf.getProperty("MicrosoftAppIdPemCertificate"), conf.getProperty("MicrosoftAppIdPemCertificatePassword")); + +// MicrosoftAppCredentials mac = new MicrosoftAppCredentials( +// conf.getProperty(MicrosoftAppCredentials.MICROSOFTAPPID), +// conf.getProperty(MicrosoftAppCredentials.MICROSOFTAPPPASSWORD), +// tennantId); + + return out; } + @Bean @ConditionalOnMissingBean public TeamsConversations teamsConversations( BotFrameworkAdapter bfa, - MicrosoftAppCredentials mac, + SpringBotMicrosoftAppCredentials appCredentials, @Value("${teams.bot.id:}") String id, TeamsStateStorage teamsState) { ChannelAccount botAccount = new ChannelAccount(id); - return new StateStorageBasedTeamsConversations(bfa, mac, botAccount, teamsState); + return new StateStorageBasedTeamsConversations(bfa, appCredentials, botAccount, teamsState); } From 170aac1e446f0ddc4f18d1f0b75d97d9cbbd3af7 Mon Sep 17 00:00:00 2001 From: vaibhav-a mankar Date: Wed, 3 Dec 2025 12:50:18 +0530 Subject: [PATCH 2/5] SYMPHONYP-1416 certificate-base-authentication --- libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml | 6 ++++++ pom.xml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml b/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml index 46311a741..ac93ae548 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml @@ -77,6 +77,12 @@ azure-storage-blob ${azure-storage-blob.version} + + + com.azure + azure-identity + ${azure-identity.version} + com.azure diff --git a/pom.xml b/pom.xml index a911bdb51..8d6c39a88 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,8 @@ 1.17.2 23.0.3 3.0.0 - 1.16.1 + 1.16.1 + 1.18.0 4.5.7 1.21.0 1.16 From 3d540e7f168a1137b0e39df5f1409faf36201cf4 Mon Sep 17 00:00:00 2001 From: vaibhav-a mankar Date: Wed, 3 Dec 2025 12:54:21 +0530 Subject: [PATCH 3/5] SYMPHONYP-1416 certificate-base-authentication --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8d6c39a88..4b66e7f21 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ 23.0.3 3.0.0 1.16.1 - 1.18.0 + 1.18.0 4.5.7 1.21.0 1.16 From 3ab102be6bcc0d21426a1d07018b7a859dd68d6a Mon Sep 17 00:00:00 2001 From: vaibhav-a mankar Date: Fri, 5 Dec 2025 18:12:55 +0530 Subject: [PATCH 4/5] SYMPHONYP-1416 certificate-base-authentication --- .../SpringBotAppCredentials.java | 15 ++++++ .../SpringBotMicrosoftAppCredentials.java | 51 ++++++++++--------- .../TeamsConversationsConfig.java | 8 ++- .../teams/MockTeamsConfiguration.java | 7 +++ .../MockSpringBotMicrosoftAppCredentials.java | 27 ++++++++++ 5 files changed, 79 insertions(+), 29 deletions(-) create mode 100644 libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotAppCredentials.java create mode 100644 libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/conversations/MockSpringBotMicrosoftAppCredentials.java diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotAppCredentials.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotAppCredentials.java new file mode 100644 index 000000000..1626cd312 --- /dev/null +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotAppCredentials.java @@ -0,0 +1,15 @@ +package org.finos.springbot.teams.conversations; + +import com.azure.identity.ClientCertificateCredential; + +public interface SpringBotAppCredentials { + + String getTenantId(); + + String getClientId(); + + ClientCertificateCredential getCredential(); + + String getToken(); + +} \ No newline at end of file diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java index 4463566ef..cb2446fe3 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/SpringBotMicrosoftAppCredentials.java @@ -1,9 +1,6 @@ package org.finos.springbot.teams.conversations; -import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Base64; @@ -12,56 +9,62 @@ import com.azure.identity.ClientCertificateCredential; import com.azure.identity.ClientCertificateCredentialBuilder; -public class SpringBotMicrosoftAppCredentials { - - private String tenantId; - private String clientId; - private ClientCertificateCredential credential; +public class SpringBotMicrosoftAppCredentials implements SpringBotAppCredentials { + private String tenantId = null; + private String clientId = null; + private ClientCertificateCredential credential = null; + public SpringBotMicrosoftAppCredentials(String tenantId, String clientId, String certificate, String certificatePassword) { this.tenantId = tenantId; this.clientId = clientId; String pemContent = certificate; - // Check for file extension and illegal path characters - boolean isFilePath = (certificate != null && (certificate.endsWith(".p12"))); try { - if (!isFilePath) { - byte[] decode = Base64.getDecoder().decode(pemContent); - java.nio.file.Path tempFile = Files.createTempFile("cert", ".p12"); - Files.write(tempFile, decode); - certificate = tempFile.toAbsolutePath().toString(); - } + // Check for file extension and illegal path characters + boolean isFilePath = (certificate != null && (certificate.endsWith(".p12"))); + + if (certificate != null) { + if (!isFilePath) { + byte[] decode = Base64.getDecoder().decode(pemContent); + + java.nio.file.Path tempFile = Files.createTempFile("cert", ".p12"); + Files.write(tempFile, decode); + certificate = tempFile.toAbsolutePath().toString(); + } - this.credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId) - .pemCertificate(Files.newInputStream(Paths.get(certificate))) - .clientCertificatePassword(certificatePassword).build(); + this.credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId) + .pemCertificate(Files.newInputStream(Paths.get(certificate))) + .clientCertificatePassword(certificatePassword).build(); + } } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("Failed to create certificate", e); } - } + } + + @Override public String getTenantId() { return tenantId; } + @Override public String getClientId() { return clientId; } + @Override public ClientCertificateCredential getCredential() { return credential; } + @Override public String getToken() { - // SOMETHING LIKE THIS return credential.getTokenSync(new TokenRequestContext().addScopes("https://graph.microsoft.com/.default")) .getToken(); } - public static InputStream stringToInputStream(String content) { - return new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); - } + } \ No newline at end of file diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java index fbd155846..3ebbd22d2 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java @@ -10,9 +10,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; -import com.azure.identity.ClientCertificateCredential; import com.microsoft.bot.builder.BotFrameworkAdapter; -import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials; import com.microsoft.bot.integration.AdapterWithErrorHandler; import com.microsoft.bot.integration.BotFrameworkHttpAdapter; import com.microsoft.bot.schema.ChannelAccount; @@ -20,12 +18,12 @@ public class TeamsConversationsConfig extends BotDependencyConfiguration { @Bean - public SpringBotMicrosoftAppCredentials microsoftCredentials(@Value("${teams.app.tennantId}") String tennantId) { + public SpringBotAppCredentials microsoftCredentials(@Value("${teams.app.tennantId}") String tennantId) { com.microsoft.bot.integration.Configuration conf = getConfiguration(); - String clientId = conf.getProperty(MicrosoftAppCredentials.MICROSOFTAPPID); + String clientId = conf.getProperty(com.microsoft.bot.connector.authentication.MicrosoftAppCredentials.MICROSOFTAPPID); - SpringBotMicrosoftAppCredentials out = new SpringBotMicrosoftAppCredentials(tennantId, + SpringBotAppCredentials out = new SpringBotMicrosoftAppCredentials(tennantId, clientId, conf.getProperty("MicrosoftAppIdPemCertificate"), conf.getProperty("MicrosoftAppIdPemCertificatePassword")); // MicrosoftAppCredentials mac = new MicrosoftAppCredentials( diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java index a82d3cac6..4e5933eb7 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java @@ -1,5 +1,7 @@ package org.finos.springbot.teams; +import org.finos.springbot.teams.conversations.MockSpringBotMicrosoftAppCredentials; +import org.finos.springbot.teams.conversations.SpringBotAppCredentials; import org.finos.springbot.tests.controller.OurController; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -18,5 +20,10 @@ public LocalValidatorFactoryBean localValidatorFactoryBean() { public OurController ourController() { return new OurController(); } + + @Bean + public SpringBotAppCredentials dummyMicrosoftCredentials() { + return new MockSpringBotMicrosoftAppCredentials(); + } } \ No newline at end of file diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/conversations/MockSpringBotMicrosoftAppCredentials.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/conversations/MockSpringBotMicrosoftAppCredentials.java new file mode 100644 index 000000000..18ca1b3ec --- /dev/null +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/conversations/MockSpringBotMicrosoftAppCredentials.java @@ -0,0 +1,27 @@ +package org.finos.springbot.teams.conversations; + +import com.azure.identity.ClientCertificateCredential; + +public class MockSpringBotMicrosoftAppCredentials implements SpringBotAppCredentials { + + @Override + public String getTenantId() { + return "mock-tenant-id"; + } + + @Override + public String getClientId() { + return "mock-client-id"; + } + + @Override + public ClientCertificateCredential getCredential() { + return null; + } + + @Override + public String getToken() { + return "mock-token"; + } + +} From 0a244f726e23031d1cae2699a4ee2ddd47c58ee2 Mon Sep 17 00:00:00 2001 From: vaibhav-a mankar Date: Tue, 9 Dec 2025 12:42:46 +0530 Subject: [PATCH 5/5] SYMPHONYP-1416 certificate-base-authentication --- .../teams/conversations/AbstractTeamsConversations.java | 4 ++-- .../conversations/StateStorageBasedTeamsConversations.java | 2 +- .../teams/conversations/TeamsConversationsConfig.java | 2 +- .../org/finos/springbot/teams/MockTeamsConfiguration.java | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java index e5261f1a8..d0f4ee3c3 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/AbstractTeamsConversations.java @@ -39,11 +39,11 @@ */ public abstract class AbstractTeamsConversations implements TeamsConversations { - private SpringBotMicrosoftAppCredentials mac; + private SpringBotAppCredentials mac; private BotFrameworkAdapter bfa; private ChannelAccount botAccount; - public AbstractTeamsConversations(BotFrameworkAdapter bfa, SpringBotMicrosoftAppCredentials mac, ChannelAccount botAccount) { + public AbstractTeamsConversations(BotFrameworkAdapter bfa, SpringBotAppCredentials mac, ChannelAccount botAccount) { super(); this.mac = mac; this.bfa = bfa; diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java index 4db0cc83e..3716e3a2b 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/StateStorageBasedTeamsConversations.java @@ -33,7 +33,7 @@ public class StateStorageBasedTeamsConversations extends AbstractTeamsConversati protected final TeamsStateStorage tss; - public StateStorageBasedTeamsConversations(BotFrameworkAdapter bfa, SpringBotMicrosoftAppCredentials mac, + public StateStorageBasedTeamsConversations(BotFrameworkAdapter bfa, SpringBotAppCredentials mac, ChannelAccount botAccount, TeamsStateStorage tss) { super(bfa, mac, botAccount); this.tss = tss; diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java index 3ebbd22d2..1fbbe491d 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/conversations/TeamsConversationsConfig.java @@ -39,7 +39,7 @@ public SpringBotAppCredentials microsoftCredentials(@Value("${teams.app.tennant @ConditionalOnMissingBean public TeamsConversations teamsConversations( BotFrameworkAdapter bfa, - SpringBotMicrosoftAppCredentials appCredentials, + SpringBotAppCredentials appCredentials, @Value("${teams.bot.id:}") String id, TeamsStateStorage teamsState) { ChannelAccount botAccount = new ChannelAccount(id); diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java index 4e5933eb7..bb69065f5 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/MockTeamsConfiguration.java @@ -5,6 +5,7 @@ import org.finos.springbot.tests.controller.OurController; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; @Configuration @@ -22,6 +23,7 @@ public OurController ourController() { } @Bean + @Primary public SpringBotAppCredentials dummyMicrosoftCredentials() { return new MockSpringBotMicrosoftAppCredentials(); }