SkillValidation Class
- java.
lang. Object - com.
microsoft. bot. connector. authentication. SkillValidation
- com.
public final class SkillValidation
Validates JWT tokens sent to and from a Skill.
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
static
java.util.concurrent.CompletableFuture<Claims |
authenticateChannelToken(String authHeader, CredentialProvider credentials, ChannelProvider channelProvider, String channelId, AuthenticationConfiguration authConfig)
Validates that the incoming Auth Header is a token sent from a bot to a skill or from a skill to a bot. |
|
static
Claims |
createAnonymousSkillClaim()
Creates a Claims |
| static java.lang.Boolean |
isSkillClaim(Map<String,String> claims)
Checks if the given list of claims represents a skill. |
| static boolean |
isSkillToken(String authHeader)
Determines if a given Auth header is from from a skill to bot or bot to skill request. |
| static java.util.concurrent.CompletableFuture<java.lang.Void> |
validateIdentity(ClaimsIdentity identity, CredentialProvider credentials)
Helper to validate a skills Claims |
Methods inherited from java.lang.Object
Method Details
authenticateChannelToken
public static CompletableFuture
Validates that the incoming Auth Header is a token sent from a bot to a skill or from a skill to a bot.
Parameters:
Returns:
createAnonymousSkillClaim
public static ClaimsIdentity createAnonymousSkillClaim()
Creates a ClaimsIdentity for an anonymous (unauthenticated) skill.
Returns:
isSkillClaim
public static Boolean isSkillClaim(Map
Checks if the given list of claims represents a skill. A skill claim should contain: An VERSION_CLAIM claim. An AuthenticationConstants.AUTIENCE_CLAIM claim. An APPID_CLAIM claim (v1) or an a AUTHORIZED_PARTY claim (v2). And the appId claim should be different than the audience claim. When a channel (webchat, teams, etc.) invokes a bot, the AuthenticationConstants.AUTIENCE_CLAIM is set to TO_BOT_FROM_CHANNEL_TOKEN_ISSUER but when a bot calls another bot, the audience claim is set to the appId of the bot being invoked. The protocol supports v1 and v2 tokens: For v1 tokens, the APPID_CLAIM is present and set to the app Id of the calling bot. For v2 tokens, the AUTHORIZED_PARTY is present and set to the app Id of the calling bot.
Parameters:
Returns:
isSkillToken
public static boolean isSkillToken(String authHeader)
Determines if a given Auth header is from from a skill to bot or bot to skill request.
Parameters:
Returns:
validateIdentity
public static CompletableFuture
Helper to validate a skills ClaimsIdentity.
Parameters:
Returns: