public async void GovernmentChannelValidation_Succeeds() { var appId = "1234567890"; var serviceUrl = "https://webchat.botframework.com/"; var credentials = new SimpleCredentialProvider(appId, String.Empty); var identity = new SimpleClaimsIdentity(new List <Claim>() { new Claim(AuthenticationConstants.AudienceClaim, appId, null, GovernmentAuthenticationConstants.ToBotFromChannelTokenIssuer), new Claim(AuthenticationConstants.ServiceUrlClaim, serviceUrl, null), }, true); await GovernmentChannelValidation.ValidateIdentity(identity, credentials, serviceUrl); }
public async void GovernmentChannelValidation_NoAudienceClaim_Fails() { var appId = "1234567890"; var serviceUrl = "https://webchat.botframework.com/"; var credentials = new SimpleCredentialProvider(appId, String.Empty); var identity = new SimpleClaimsIdentity(new List <Claim>() { new Claim(AuthenticationConstants.ServiceUrlClaim, serviceUrl, null), }, true); await Assert.ThrowsAsync <UnauthorizedAccessException>( async() => await GovernmentChannelValidation.ValidateIdentity(identity, credentials, serviceUrl)); }