Skip to content

Commit

Permalink
Migrating ADAL to MSAL. (microsoftgraph#86)
Browse files Browse the repository at this point in the history
* Migrating ADAL to MSAL.

* Setting logging options via app options.

* Fix permissions.

* Manifest update.
  • Loading branch information
ksikorsk authored Jun 24, 2019
1 parent 3eb960a commit 7da64b2
Show file tree
Hide file tree
Showing 47 changed files with 2,515 additions and 2,473 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.ignore.*

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

Expand Down Expand Up @@ -266,3 +268,4 @@ _site/
# local-only setting files
appsettings.development.json
*.development.pubxml
*.original
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,18 @@ public Bot(BotOptions options, IGraphLogger graphLogger)
var instanceNotificationUri = CallAffinityMiddleware.GetWebInstanceCallbackUri(new Uri(options.BotBaseUrl, HttpRouteConstants.OnIncomingRequestRoute));

this.graphLogger = graphLogger;
var name = this.GetType().Assembly.GetName().Name;
var builder = new CommunicationsClientBuilder(
name,
options.AppId,
this.graphLogger);

var authProvider = new AuthenticationProvider(
name,
options.AppId,
options.AppSecret,
this.graphLogger);

var builder = new CommunicationsClientBuilder("IcmBot", options.AppId, this.graphLogger);
builder.SetAuthenticationProvider(authProvider);
builder.SetNotificationUrl(instanceNotificationUri);
builder.SetServiceBaseUrl(options.PlaceCallEndpointUrl);
Expand Down
10 changes: 10 additions & 0 deletions Samples/BetaSamples/RemoteMediaSamples/IncidentBot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ The sample demostrate an incident process workflow. When a incident raised (thro
- Write down the application ID \{ApplicationId} and \{ApplicationSecret} for next steps.
- Click "IncidentBot" in "Bot Services" resource type page, Click "Channels", Then select "Microsoft Teams" and "Skype" channels and enable both of them.
- Click "edit" button of "Skype" channel, click "Calling" tab, select "Enable calling" radio button, then select "IVR - 1:1 IVR audio calls", and fill the Webhook (for calling) edit box with value "\{BotBaseUrl}/callback/calling".
* Configure permissions for the Bot.
- Go to Application Registration Portal (https://apps.dev.microsoft.com/).
- Select your registered bot application.
- Click "Add" under Microsoft Graph Permissions --> Application Permissions.
- Select all permissions starting with "Calls.", i.e. "Calls.AccessMedia.All", "Calls.Initiate.All", etc.
- Click "Ok" and then "Save"
* Consent the permissions
- Go to "https://login.microsoftonline.com/common/adminconsent?client_id=<app_id>&state=<any_number>&redirect_uri=<any_callback_url>"
- Sign in with a tenant admin
- Consent for the whole tenant.
* Update the following elements in appsettings.json file in project IncidentBot.
- Bot/AppId: "\{ApplicationId}"
- Bot/AppSecret: "\{ApplicationSecret}"
Expand Down
4 changes: 2 additions & 2 deletions Samples/BetaSamples/RemoteMediaSamples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ The Incident Bot sample is a Remote Media sample demonstrating a simple incident
1. Add the following Application Permissions to the bot:

* Calls.AccessMedia.All
* Calls.Initiate
* Calls.Initiate.All
* Calls.JoinGroupCall.All
* Calls.JoinGroupAsGuestCall.All
* Calls.JoinGroupCallAsGuest.All

1. The permissions need to be consented by tenant admin. Go to "https://login.microsoftonline.com/common/adminconsent?client_id=<app_id>&state=<any_number>&redirect_uri=<any_callback_url>" using tenant admin to sign-in, then consent for the whole tenant.

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Sample.OnlineMeeting
using System;
using System.Threading.Tasks;
using Microsoft.Graph;
using Microsoft.Graph.Communications.Client.Authentication;
using Microsoft.Graph.Communications.Core;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
<Import Project="$(MSBuildThisFileDirectory)..\..\..\Graph.props" />

<ItemGroup>
<PackageReference Include="Microsoft.Graph.Communications.Client" Version="1.1.0-prerelease.581" />
<PackageReference Include="Microsoft.Graph.Communications.Core.Calls" Version="1.1.0-prerelease.581" />
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.19.8" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Common\Sample.Common\Sample.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace Sample.OnlineMeeting
{
using System;
using System.Threading.Tasks;
using Microsoft.Graph.Communications.Common.Telemetry;
using Sample.Common.Authentication;

/// <summary>
/// Default program class.
Expand All @@ -30,8 +32,10 @@ public class Program
/// <returns> The onlinemeeting details. </returns>
public static async Task<Microsoft.Graph.OnlineMeeting> GetOnlineMeetingAsync(string tenantId, string meetingId)
{
var name = typeof(Program).Assembly.GetName().Name;
var logger = new GraphLogger(name);
var onlineMeeting = new OnlineMeeting(
new RequestAuthenticationProvider(appId, appSecret),
new AuthenticationProvider(name, appId, appSecret, logger),
graphUri);

var meetingDetails = await onlineMeeting.GetOnlineMeetingAsync(tenantId, meetingId, default(Guid)).ConfigureAwait(false);
Expand All @@ -50,8 +54,10 @@ public class Program
/// <returns> The newly created onlinemeeting. </returns>
public static async Task<Microsoft.Graph.OnlineMeeting> CreateOnlineMeetingAsync(string tenantId, string organizerId)
{
var name = typeof(Program).Assembly.GetName().Name;
var logger = new GraphLogger(name);
var onlineMeeting = new OnlineMeeting(
new RequestAuthenticationProvider(appId, appSecret),
new AuthenticationProvider(name, appId, appSecret, logger),
graphUri);

var meetingDetails = await onlineMeeting.CreateOnlineMeetingAsync(tenantId, organizerId, default(Guid)).ConfigureAwait(false);
Expand Down

This file was deleted.

Loading

0 comments on commit 7da64b2

Please sign in to comment.