functions-authorize
functions-authorize copied to clipboard
How can we perform .NET 8 In-Proc mode JWT authentication do we have any example?
Currently we are doing JWT authentication in .NET 8 function app but after deployment i am getting runtime error due to functionAuthorize tag. Can you please provide me one sample code base
we are using above package
@artmasa
Full Exception : Exception while executing function /GetAirportCodes ---> DryIoc.ContainerException /Dependency Microsoft.AspNetCore.Authorization.IAuthorizationHandler {Service[Hidden Credential]'s /singleton DarkLoop.Azure.Functions.Authorization.FunctionsAuthorizationExecutor /DarkLoop.Azure.Functions.Authorization.IFunctionsAuthorizationExecutor {ReturnDefault} #2260 from scoped container with {no name} To turn Off this error, specify the rule with new Container(rules => rules.WithoutThrowIfDependencyHasShorterReuseLifespan()). DryIoc.Throw.It(Int32 error,Object arg0,Object arg1,Object arg2,Object arg3) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /9003 DryIoc.Request.ThrowIfReuseHasShorterLifespanThanParent(IReuse reuse) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /5875 DryIoc.Request.WithResolvedFactory(Factory factory,Boolean skipRecursiveDependencyCheck,Boolean skipCaptiveDependencyCheck) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /5798 DryIoc.Factory.GetExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /6524 DryIoc.WrappersSupport.GetArrayExpression(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /2903 DryIoc.Factory.GetExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /6554 DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /7083 DryIoc.Factory.GetExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /6554 DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /7083 DryIoc.Factory.GetExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /6554 DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /7083 DryIoc.Factory.GetExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /6554 DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /7083 DryIoc.Factory.GetExpressionOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /6554 DryIoc.Factory.GetDelegateOrDefault(Request request) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /6634 DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate(Type serviceType,IfUnresolved ifUnresolved) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /210 DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,IfUnresolved ifUnresolved) /src/azure-functions-host/src/WebJobs.Script.WebHost/DependencyInjection/DryIoc/Container.cs /195 Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider,Type serviceType) async DarkLoop.Azure.Functions.Authorize.FunctionAuthorizeAttribute.Microsoft-Azure-WebJobs-Host-IFunctionInvocationFilter-OnExecutingAsync(??) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.FunctionInvocationFilterInvoker.InvokeAsync(Object instance,Object[] arguments) D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs /1123 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.FunctionInvocationFilterInvoker.InvokeAsync(Object instance,Object[] arguments) D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs /1165 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance) D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs /581 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance,ParameterHelper parameterHelper,ILogger logger,CancellationTokenSource functionCancellationTokenSource) D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs /527 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,FunctionStartedMessage message,FunctionInstanceLogEntry instanceLogEntry,ParameterHelper parameterHelper,ILogger logger,CancellationToken cancellationToken) D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs /306 End of inner exception System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,FunctionStartedMessage message,FunctionInstanceLogEntry instanceLogEntry,ParameterHelper parameterHelper,ILogger logger,CancellationToken cancellationToken) D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs /352 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken) D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs /108 has context menu
Hi @AkashDoke, I'm not familiar with this package but it seems there's a conflict on how the services are registered in IServiceCollection and how they are integrated with Dryloc. I would encourage you to pay attention to their exception message and to follow their suggestion on how to configure the services in Dryloc.