Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -582,27 +582,17 @@ public void GovernmentChannelValidation_WrongServiceClaimValue_Fails() {
}

private void JwtTokenValidation_ValidateAuthHeader_WithChannelService_Succeeds(String appId, String pwd, String channelService) throws IOException, ExecutionException, InterruptedException {
ChannelProvider channel = new SimpleChannelProvider(channelService);
String header = channel.isGovernment() ? getGovHeaderToken() : getHeaderToken();

JwtTokenValidation_ValidateAuthHeader_WithChannelService_Succeeds(header, appId, pwd, channel);
String header = "Bearer " + new MicrosoftAppCredentials(appId, pwd).getToken().join();
JwtTokenValidation_ValidateAuthHeader_WithChannelService_Succeeds(header, appId, pwd, channelService);
}

private void JwtTokenValidation_ValidateAuthHeader_WithChannelService_Succeeds(String header, String appId, String pwd, ChannelProvider channel) {
private void JwtTokenValidation_ValidateAuthHeader_WithChannelService_Succeeds(String header, String appId, String pwd, String channelService) {
CredentialProvider credentials = new SimpleCredentialProvider(appId, pwd);
ChannelProvider channel = new SimpleChannelProvider(channelService);

try {
ClaimsIdentity identity = JwtTokenValidation.validateAuthHeader(
header,
credentials,
channel,
"",
"https://webchat.botframework.com/").join();
ClaimsIdentity identity = JwtTokenValidation.validateAuthHeader(header, credentials, channel, null, "https://webchat.botframework.com/").join();

Assert.assertTrue(identity.isAuthenticated());
} catch (Exception e) {
Assert.fail("Should not have thrown " + e.getClass().getName());
}
Assert.assertTrue(identity.isAuthenticated());
}

private void JwtTokenValidation_ValidateAuthHeader_WithChannelService_Throws(String header, String appId, String pwd, String channelService) throws ExecutionException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,28 @@ public void teamsNotifyUser() {
teamsChannelData.setNotification(new NotificationInfo(true));
}

/**
* Sets the notification of a meeting in the TeamsChannelData.
* @param alertInMeeting True if this is a meeting alert.
* @param externalResourceUrl The external resource Url.
*/
public void teamsNotifyUser(boolean alertInMeeting, String externalResourceUrl) {
TeamsChannelData teamsChannelData;

try {
teamsChannelData = getChannelData(TeamsChannelData.class);
} catch (JsonProcessingException jpe) {
teamsChannelData = null;
}

if (teamsChannelData == null) {
teamsChannelData = new TeamsChannelData();
setChannelData(teamsChannelData);
}

teamsChannelData.setNotification(new NotificationInfo(true, externalResourceUrl));
}

/**
* Returns this activity as a Message Activity; or null, if this is not that type of activity.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ public class NotificationInfo {
@JsonProperty(value = "alert")
private Boolean alert;

/**
* Initialize new NotificationInfo.
*
* @param withAlert initial alert value.
*/
public NotificationInfo(boolean withAlert) {
setAlert(withAlert);
}
@JsonProperty(value = "alertInMeeting")
private Boolean alertInMeeting;

@JsonProperty(value = "externalResourceUrl")
private String externalResourceUrl;

/**
* Getter for alert.
Expand All @@ -42,6 +39,38 @@ public void setAlert(Boolean withAlert) {
alert = withAlert;
}

/**
* Indicates if this is a meeting alert.
* @return True if this is a meeting alert.
*/
public Boolean getAlertInMeeting() {
return alertInMeeting;
}

/**
* Indicates if this is a meeting alert.
* @param withAlertInMeeting True if this is a meeting alert.
*/
public void setAlertInMeeting(Boolean withAlertInMeeting) {
alertInMeeting = withAlertInMeeting;
}

/**
* Gets the resource Url of a meeting alert.
* @return The external resource url.
*/
public String getExternalResourceUrl() {
return externalResourceUrl;
}

/**
* The resource Url of a meeting alert.
* @param withExternalResourceUrl The external resource Url.
*/
public void setExternalResourceUrl(String withExternalResourceUrl) {
externalResourceUrl = withExternalResourceUrl;
}

/**
* A new instance of NotificationInfo.
*
Expand All @@ -51,6 +80,17 @@ public NotificationInfo(Boolean withAlert) {
alert = withAlert;
}

/**
* A new instance of a meeting alert.
* @param withAlertInMeeting True if this is a meeting alert.
* @param withExternalResourceUrl The external resource Url.
*/
public NotificationInfo(boolean withAlertInMeeting, String withExternalResourceUrl) {
setAlert(true);
setAlertInMeeting(withAlertInMeeting);
setExternalResourceUrl(withExternalResourceUrl);
}

/**
* A new instance of NotificationInfo.
*/
Expand Down