BenMorris / FunctionsCustomSercuity

A basic sample demonstrating how custom input binding can be used to support custom authentication for Azure Functions.
76 stars 22 forks source link

Compatibility with Azure Functions v3? #11

Open jsancho opened 4 years ago

jsancho commented 4 years ago

Hi Ben,

Thanks so much for putting this project together, I've managed to get going quite easily :)

I've noticed that after upgrading my AF project to v3 and .Net Core 3., it fails to perform the binding.

Here's the error message that shows for all functions that have the [AccessToken] AccessTokenResult accessTokenResult binding.

Function 'unregisterFromGroup' failed indexing and will be disabled.
[02/04/2020 09:52:42] Microsoft.Azure.WebJobs.Host: Error indexing method 'negotiate'. 
Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'accessTokenResult' 
to type AccessTokenResult. Make sure the parameter Type is supported by the binding.
 If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) 
make sure you've called the registration method for the extension(s) in your 
startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(),
 builder.AddTimers(), etc.).

Have you had an opportunity to try out v3? Any ideas on how could we approach this? I'm going to continue poking it to see if I can come up with but would definitely appreciate your thoughts.

cheers

ianrandell-sh commented 3 years ago

@jsancho - did you manage to get it working with v3 funcs ?

jsancho commented 3 years ago

@jsancho - did you manage to get it working with v3 funcs ?

I'm afraid I did not manage to make it work.

Just looked at the git history for the Azure Function project that needed JWT verification and noticed that I migrated the logic to use node instead.

ps: I would be wary of dedicating too much time to custom bindings for .NET-based functions with v3, as there are many more drastic changes coming up with .NET 6.0. There's a preview of .NET 5.0 for AF, but that's been far from a smooth release process https://github.com/Azure/azure-functions-core-tools/issues/2304

ianrandell-sh commented 3 years ago

Understood. Ill stick with the DI solution. Thanks for responding 👍