Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication Scheme and Authorization policy Registration in Startup in Azure Function V2 #4397

Open
JishanK opened this issue May 8, 2019 · 16 comments
Labels
Milestone

Comments

@JishanK
Copy link

JishanK commented May 8, 2019

Can we register Authentication Scheme and Authorization policy in startup which inherits FunctionsStartup. While I am trying, I am getting below exception.

Microsoft.AspNetCore.Authentication.Core: No authentication handler is registered for the scheme 'WebJobsAuthLevel'. The registered schemes are: AADScheme. Did you forget to call AddAuthentication().AddSomeAuthHandler

@JishanK JishanK changed the title Authentication Scheme and Authorization policy in Registration in Startup in Azure Function V2 Authentication Scheme and Authorization policy Registration in Startup in Azure Function V2 May 8, 2019
@paululvinius
Copy link

Having the same issue when trying to add certificate authentication middleware in my function app startup code. Need to validate incoming client certificate for every request and make sure it has a specific thumbprint. Any hints on how to accomplish this given this issue?

@AnunnakiSelva
Copy link

@JishanK Can you able to figure out how to add authentication handler in FunctionsStartup ??

@AnunnakiSelva
Copy link

@alrod Any update on this issues ? Is there a way to add custom token authentication ??

@alrod
Copy link
Member

alrod commented May 24, 2019

@fabiocav, can you please comment.

@fabiocav
Copy link
Member

The ASP.NET authentication and middleware pipeline configuration (injection/modification) is not (currently) a supported scenario. Flagging this as a feature request.

@Arash-Sabet
Copy link

Any ETA on when this feature will be rolled out? According to the issue reported in Azure/azure-functions-core-tools/issues/1341 we are pretty much stuck and unable to progress at all!

@jeffhollan @fabiocav

/cc @miladghafoori

@jeffhollan
Copy link

It's not currently prioritized into coming in the near future. So hard to give an ETA. It's a valid feature request but not something that is committed to in the next 3 months. Definitely helps when community helps upvote or +1 as well to help us prioritize correctly.

@Arash-Sabet
Copy link

Arash-Sabet commented Jun 27, 2019

@jeffhollan Well, I originally raised an issue in /Azure/azure-functions-core-tools/issues/1341 and then I was diverted to this ticket. The issue in that ticket is a showstopper and we could not find a workaround or other ways to address it so far. It's a bit confusing as I have had the impression that it has become a high priority item to address.

I hope the ticket per this comment is still a high priority: Azure/azure-functions-core-tools#1341 (comment)

/cc @miladghafoori

@gynet
Copy link

gynet commented Sep 5, 2019

is there any update or workaround on this? I think it's import for Azure function to support auth middleware

@espray
Copy link

espray commented Sep 6, 2019

I dont know of anyway to hook into the middleware. But, you can get auth to work.
See here: #4485

@gynet
Copy link

gynet commented Sep 6, 2019

I did add the schema into the constructor, it still has the error of "No authentication handler is registered for the scheme 'WebJobsAuthLevel'", which schema should I register for WebJobsAuthLevel?

      this._authenticationSchemeProvider = authenticationSchemeProvider;

            if (_authenticationSchemeProvider.GetSchemeAsync(IdentityConstants.ApplicationScheme).GetAwaiter().GetResult() == null)
            {
                _authenticationSchemeProvider.AddScheme(new AuthenticationScheme(IdentityConstants.ApplicationScheme, IdentityConstants.ApplicationScheme, typeof(CookieAuthenticationHandler)));
            }
            if (_authenticationSchemeProvider.GetSchemeAsync(IdentityConstants.TwoFactorUserIdScheme).GetAwaiter().GetResult() == null)
            {
                _authenticationSchemeProvider.AddScheme(new AuthenticationScheme(IdentityConstants.TwoFactorUserIdScheme, IdentityConstants.TwoFactorUserIdScheme, typeof(CookieAuthenticationHandler)));
            }
            if (_authenticationSchemeProvider.GetSchemeAsync(IdentityConstants.TwoFactorRememberMeScheme).GetAwaiter().GetResult() == null)
            {
         ```

@mmulhearn
Copy link

It's not currently prioritized into coming in the near future. So hard to give an ETA. It's a valid feature request but not something that is committed to in the next 3 months. Definitely helps when community helps upvote or +1 as well to help us prioritize correctly.

Where do we +1 this feature request?

@espray
Copy link

espray commented Jan 20, 2021

@mmulhearn you can follow this issue #6805

@mmulhearn
Copy link

hm not sure that's what i'm looking for @espray . I want what this thread is asking for which is pretty much to use the aspnet core authentication and authorization middleware in a function.

@esimkowitz
Copy link

+1 this seems like an important scenario, especially for users of Azure Functions on k8s, where they can't utilize the TLS implementation in Azure App Service

@artmasa
Copy link

artmasa commented Nov 18, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests