MicrosoftDX / AuthBot

General authentication/authorization Bot Framework sample
MIT License
82 stars 54 forks source link

Extension methods not available in Scorable #35

Open ankitbko opened 7 years ago

ankitbko commented 7 years ago

I want to use AuthBot in a Scorable. The Scorable will act as middleware and make sure the user is authenticated before allowing Dialogs to take over.

Now this works quite fine. The problem is that I don't have access to IBotContext in Scorable. Autofac will throw error if you try to get it from constructor. This means that I can't use any of the extensions to get token.

If I re-implement the extensions on IBotData instead, everything works. In fact IBotContext derives from IBotData. But this approach just leads to code duplication. I had literally copy pasted the entire code and just modified it to extend on IBotData. The only drawback is that we can't use context.PostAsync to send reply back to user.

Any thoughts on moving the extension methods to IBotData?