Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Open
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
Fixed return types for CompleatableFuture
  • Loading branch information
ldardick committed Aug 20, 2021
commit ffc0df8ecc3feebe7a4383cc03e4ac58263999a8
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

package com.microsoft.bot.connector.authentication;

import com.microsoft.bot.connector.Async;
import com.microsoft.bot.connector.Channels;
import com.microsoft.bot.connector.skills.BotFrameworkClient;
import com.microsoft.bot.schema.Activity;
import com.microsoft.bot.schema.RoleTypes;
import okhttp3.OkHttpClient;
import org.apache.commons.lang3.StringUtils;

import java.time.Duration;
import java.util.Arrays;
import java.util.Map;
Expand Down Expand Up @@ -123,31 +125,30 @@ public CompletableFuture<AuthenticateRequestResult> authenticateRequest(Activity
@Override
public CompletableFuture<AuthenticateRequestResult> authenticateStreamingRequest(String authHeader,
String channelIdHeader) {
if (StringUtils.isNotBlank(channelIdHeader)) {
this.credentialsFactory.isAuthenticationDisabled().thenCompose(isAuthDisabled -> {
if (isAuthDisabled) {
return jwtTokenValidationValidateAuthHeader(authHeader, channelIdHeader, null)
.thenCompose(claimsIdentity -> {
String outboundAudience = SkillValidation.isSkillClaim(claimsIdentity.claims())
? JwtTokenValidation.getAppIdFromClaims(claimsIdentity.claims())
: this.toChannelFromBotOAuthScope;

return generateCallerId(this.credentialsFactory, claimsIdentity, this.callerId)
.thenCompose(resultCallerId -> {
AuthenticateRequestResult authenticateRequestResult = new AuthenticateRequestResult();
authenticateRequestResult.setClaimsIdentity(claimsIdentity);
authenticateRequestResult.setAudience(outboundAudience);
authenticateRequestResult.setCallerId(resultCallerId);

return CompletableFuture.completedFuture(authenticateRequestResult);
});
}
);
}
return null;
});
}
throw new AuthenticationException("channelId header required");

return this.credentialsFactory.isAuthenticationDisabled().thenCompose(isAuthDisabled -> {

if (StringUtils.isBlank(channelIdHeader) && !isAuthDisabled) {
throw new AuthenticationException("channelId header required when authentication is enabled");
}

return jwtTokenValidationValidateAuthHeader(authHeader, channelIdHeader, null)
.thenCompose(claimsIdentity -> {
String outboundAudience = SkillValidation.isSkillClaim(claimsIdentity.claims())
? JwtTokenValidation.getAppIdFromClaims(claimsIdentity.claims())
: this.toChannelFromBotOAuthScope;

return generateCallerId(this.credentialsFactory, claimsIdentity, this.callerId)
.thenCompose(callerId -> {
AuthenticateRequestResult authenticateRequestResult = new AuthenticateRequestResult();
authenticateRequestResult.setClaimsIdentity(claimsIdentity);
authenticateRequestResult.setAudience(outboundAudience);
authenticateRequestResult.setCallerId(callerId);

return CompletableFuture.completedFuture(authenticateRequestResult);
});
});
});
}

/**
Expand Down Expand Up @@ -229,7 +230,7 @@ private CompletableFuture<Void> jwtTokenValidationValidateClaims(Map<String, Str
} else if (SkillValidation.isSkillClaim(claims)) {
throw new AuthenticationException("ClaimsValidator is required for validation of Skill Host calls.");
}
return null;
return CompletableFuture.completedFuture(null);
}

private CompletableFuture<ClaimsIdentity> jwtTokenValidationAuthenticateToken(String authHeader,
Expand Down Expand Up @@ -316,7 +317,7 @@ private CompletableFuture<Void> skillValidationValidateIdentity(ClaimsIdentity i
// Invalid appId
throw new AuthenticationException("SkillValidation.validateIdentity(): Invalid appId.");
}
return null;
return CompletableFuture.completedFuture(null);
});
}

Expand Down Expand Up @@ -422,8 +423,10 @@ private CompletableFuture<ClaimsIdentity> channelValidationauthenticateChannelTo
AuthenticationConstants.ALLOWED_SIGNING_ALGORITHMS);

return tokenExtractor.getIdentity(authHeader, channelId, this.authConfiguration.requiredEndorsements())
.thenCompose(identity -> governmentChannelValidationValidateIdentity(identity, serviceUrl)
.thenApply(result -> identity));
.thenCompose(identity -> {
governmentChannelValidationValidateIdentity(identity, serviceUrl).join();
return CompletableFuture.completedFuture(identity);
});
}

private TokenValidationParameters channelValidationGetTokenValidationParameters() {
Expand Down Expand Up @@ -490,7 +493,7 @@ private CompletableFuture<Void> governmentChannelValidationValidateIdentity(Clai
throw new AuthenticationException("Unauthorized. ServiceUrl claim do not match.");
}
}
return null;
return CompletableFuture.completedFuture(null);
});
}

Expand Down