Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
31eef7d
Move InvokeResponse and TypedInvokeResponse to bot-schema
Batta32 Jul 14, 2021
0f8a03a
Relocate BotFrameworkClient to bot-connector
Batta32 Jul 14, 2021
f4ad8ab
Add Skill handle of CloudAdapter
Batta32 Jul 14, 2021
99b6908
Add Authentication configuration for CloudAdapter
Batta32 Jul 14, 2021
fe8cd7c
Add main classes of CloudAdapter and CloudAdapterBase
Batta32 Jul 14, 2021
9df6bef
Update necessary classes due to CloudAdapter and relocation of changes
Batta32 Jul 14, 2021
18c72cb
Add package-info
Batta32 Jul 14, 2021
683ed68
Add mockito in pom
Batta32 Jul 14, 2021
9ae6d8d
Add CloudAdapter tests
Batta32 Jul 14, 2021
2613e99
Add getCloudAdapter in BotDependencyConfiguration returning a new Clo…
Batta32 Jul 14, 2021
3229e97
Merge branch 'main' into internal/feature/southworks/cloudadapter/base
Batta32 Jul 14, 2021
d6f9afc
Added a Rest Controller for CloudAdapter
ldardick Aug 12, 2021
a896619
Fixed an incorrect recursive call causing a stack overflow
ldardick Aug 12, 2021
667aa8b
Fixed string comparison
ldardick Aug 12, 2021
ffc0df8
Fixed return types for CompleatableFuture
ldardick Aug 12, 2021
0132fcf
Added CloudAdapterWithInspection
ldardick Aug 12, 2021
196cc60
Fixed incorrect type reference in CloudAdapterWithErrorHandler
ldardick Aug 11, 2021
d1b9035
Add UserTokenAccess client and rewire OAuthPrompt (Mirror C# PR MS5213)
matiasroldan6 Aug 10, 2021
541de51
Add evaluation for instanceof UserTokenProvider in methods
matiasroldan6 Aug 11, 2021
ff85f8a
Add properties check in signOutUser
matiasroldan6 Aug 12, 2021
9d360b2
Add UserTokenAccessTests
matiasroldan6 Aug 13, 2021
90ed734
Roll back imports reorder
matiasroldan6 Aug 17, 2021
9ab6e89
Remove unused imports
matiasroldan6 Aug 17, 2021
a33f04c
Removed unused import
ldardick Aug 17, 2021
7a0f861
Fixed turn state key reference
ldardick Aug 17, 2021
546cb29
Change key to String in UserTokenAccessTests
matiasroldan6 Aug 17, 2021
1c3f5c7
Add sendMessageToTeamsChannel overload with CloudAdapter support
matiasroldan6 Aug 18, 2021
248cc89
Added test cases for ParameterizedBotFrameworkAuthentication
FedericoBernal Aug 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Skill handle of CloudAdapter
  • Loading branch information
Batta32 committed Jul 14, 2021
commit f4ad8ab5d1e074e6c11d927dded193fbb2d44ac8
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.microsoft.bot.builder.skills;

import com.microsoft.bot.builder.Bot;
import com.microsoft.bot.builder.BotAdapter;
import com.microsoft.bot.builder.CloudChannelServiceHandler;
import com.microsoft.bot.connector.authentication.BotFrameworkAuthentication;
import com.microsoft.bot.connector.authentication.ClaimsIdentity;
import com.microsoft.bot.schema.Activity;
import com.microsoft.bot.schema.ResourceResponse;

import java.util.concurrent.CompletableFuture;

/**
* A Bot Framework Handler for skills.
*/
public class CloudSkillHandler extends CloudChannelServiceHandler {

// The skill conversation reference.
public static final String SKILL_CONVERSATION_REFERENCE_KEY =
"com.microsoft.bot.builder.skills.SkillConversationReference";

// Delegate that implements actual logic
private final SkillHandlerImpl inner;

/**
* Initializes a new instance of the {@link CloudSkillHandler} class using BotFrameworkAuth.
* @param adapter An instance of the {@link BotAdapter} that will handle the request.
* @param bot The {@link Bot} instance.
* @param conversationIdFactory A {@link SkillConversationIdFactoryBase} to unpack the conversation ID and map it
* to the calling bot.
* @param auth Bot Framework Authentication to use.
*/
public CloudSkillHandler(
BotAdapter adapter,
Bot bot,
SkillConversationIdFactoryBase conversationIdFactory,
BotFrameworkAuthentication auth) {
super(auth);

if (adapter == null) {
throw new IllegalArgumentException("adapter cannot be null");
}

if (bot == null) {
throw new IllegalArgumentException("bot cannot be null");
}

if (conversationIdFactory == null) {
throw new IllegalArgumentException("conversationIdFactory cannot be null");
}

inner = new SkillHandlerImpl(
SKILL_CONVERSATION_REFERENCE_KEY,
adapter,
bot,
conversationIdFactory,
auth::getOriginatingAudience);
}

/**
* sendToConversation() API for Skill.
*
* This method allows you to send an activity to the end of a conversation.
*
* This is slightly different from replyToActivity().
* * sendToConversation(conversationId) - will append the activity to the end
* of the conversation according to the timestamp or semantics of the channel.
* * replyToActivity(conversationId,ActivityId) - adds the activity as a reply
* to another activity, if the channel supports it. If the channel does not
* support nested replies, ReplyToActivity falls back to sendToConversation.
*
* Use replyToActivity when replying to a specific activity in the
* conversation.
*
* Use sendToConversation in all other cases.
*
* @param claimsIdentity claimsIdentity for the bot, should have
* AudienceClaim, AppIdClaim and ServiceUrlClaim.
* @param conversationId conversationId.
* @param activity Activity to send.
*
* @return Task for a resource response.
*/
@Override
protected CompletableFuture<ResourceResponse> onSendToConversation(
ClaimsIdentity claimsIdentity,
String conversationId,
Activity activity) {
return inner.onSendToConversation(claimsIdentity, conversationId, activity);
}

/**
* replyToActivity() API for Skill.
*
* This method allows you to reply to an activity.
*
* This is slightly different from sendToConversation().
* * SendToConversation(conversationId) - will append the activity to the end
* of the conversation according to the timestamp or semantics of the channel.
* * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply
* to another activity, if the channel supports it. If the channel does not
* support nested replies, ReplyToActivity falls back to SendToConversation.
*
* Use ReplyToActivity when replying to a specific activity in the
* conversation.
*
* Use sendToConversation in all other cases.
*
* @param claimsIdentity claimsIdentity for the bot, should have
* AudienceClaim, AppIdClaim and ServiceUrlClaim.
* @param conversationId Conversation ID.
* @param activityId activityId the reply is to (OPTIONAL).
* @param activity Activity to send.
*
* @return Task for a resource response.
*/
@Override
protected CompletableFuture<ResourceResponse> onReplyToActivity(
ClaimsIdentity claimsIdentity,
String conversationId,
String activityId,
Activity activity) {
return inner.onReplyToActivity(claimsIdentity, conversationId, activityId, activity);
}

/**
* {@inheritDoc}
*/
@Override
protected CompletableFuture<Void> onDeleteActivity(
ClaimsIdentity claimsIdentity,
String conversationId,
String activityId) {
return inner.onDeleteActivity(claimsIdentity, conversationId, activityId);
}

/**
* {@inheritDoc}
*/
@Override
protected CompletableFuture<ResourceResponse> onUpdateActivity(
ClaimsIdentity claimsIdentity,
String conversationId,
String activityId,
Activity activity) {
return inner.onUpdateActivity(claimsIdentity, conversationId, activityId, activity);
}
}
Loading