Skip to content

jetiba-ms/botbuilder-utilities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

botbuilder-utilities

Bot Authentication with Azure AAD v2

Important Notes: this is a work in progress repo, probably some code blocks could be refactored and updated

This sample is to show how to work with the Bot Builder v4 and Topics in order to authenticate the user using the endpoint v2 of Azure Active Directory.

To start developing a new bot using the Bot Builder v4, you can follow the Getting Started documentation.

In order to use the authentication in your bot, you have to:

  1. Register the application in Azure AD as it is explained here
  2. Copy information from AAD into Environment Variables as
    • aad:ClientId
    • aad:ClientSecret
    • aad:RedirectUrl
    • aad:Tenant
    • aad:Scopes

The "dirty work" is all done by the class AuthenticationHelper. Here you can find 2 methods:

  • GetAuthUrlAsync to get the url for the authorization
  • GetTokenByAuthCodeAsync to get the token for the authentication

If you are not used to the Azure Active Directory authorization/authentication flow you can have a look here

In the MessagesController the conversation is routed on the proper Topic. There are 2 topics: the DefaultTopic, where there could be additional routing logic (for example using LUIS), and the AuthTopic, where the SignInCard is created with the AuthUrl generated in the helper class. For more details on how to use Topics, refer to this sample.

The OAuthCallbackController manages the AAD callback, in order to take the ConversationReference from the query and use it to create a sort of proactive message to notify the user that the authentication process was successful. Instead, you can not notify the user. Read also the docs on Proactive Messages.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages