-
Notifications
You must be signed in to change notification settings - Fork 450
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
non static V2 functions throws error when using AddAuthentication() in functionstartup #4485
Comments
@AnunnakiSelva I jumped over to this thread from #4006. I have the same issue and am hoping that we get some resolution here. I was able to get ASP Idenity |
@espray My error without
My components are also very similar to yours, looks like the same versions at the package level:
I did run across this reference which points to a new set of functions for sign-in tied to the HTTPContext. The problem would still be that there is no Authentication Handler available that would actually enable the ASP Identity signin (I was using the TwoFactorCookie version). |
For the HttpContext null exception
|
@espray I have tried something very much like that, except I did not inject the Here my Startup Class (you can see the lines for AddAuthentication commented out; if I uncomment them I get the exact same error as your second one)
And here my Function Class (you can see I tried your
|
I think I got it. I used the Dynamic Schemes sample for adding Auth Schema at runtime. Then added the missing schema AddIdentity() would have added. I would assume to get 2FA working, adding the 2FA Auth schema and registering 2FA services, might do the trick. Now that I understand this more, I wonder if I could get IdentityServer or OpenIddict working...
|
@espray Way to go! I tried your approach and at first it failed with this error: Then I remembered that my Identity Database has 2FA enabled for this user. I share this database with the MVC Web API application I mentioned earlier. After I turned off 2FA at the user level, the login succeeded. I did try to change all references to Close, but not quite there... |
I dont have 2FA project to test with. You will need to diff the AddIdentity() and AddIdentityCore(), then add the missing services, configuring the Options & adding Auth Schema. Below are the Options & Auth Schema.
|
@espray Thank you for trying to help me getting this figured out. I think I followed all of your recommendations, but somehow I do not get past the scheme being registered properly, but the authentication handler still missing: My modified Startup with the additional services from AddIdentity(), and the cookie configuration. I tried both, adding the
And here the Login Function with the
I may let this sit for a bit, my head is spinning at this point from perusing too many source code snippets. I need to work on some of the data analysis aspects of my app, maybe someone from the Azure Functions team can shed some light on this. Again, many thanks for your help and suggestions! |
@hjpsievert @espray I came across this --> builder.Services.AddSingleton(new ClientCredentialsTokenRequest
|
@espray @AnunnakiSelva Ignore the SMS/Twilio stuff, I am still working on that. It will send a text with the code, but I need to allow for email as well and the binding approach only allows for one return, right now the Twilio message. Startup
LoginUser
|
@jeffhollan not sure if you have been watching this issue. Maybe an |
Through UserManager you can do the following
Return token or something if result is true |
@jeffhollan @fabiocav Is it possible to surface a |
Is your question related to a specific version? If so, please specify:
Azure function v2 . .net core 2.2
What language does your question apply to? (e.g. C#, JavaScript, Java, All)
C#
Question
Am trying to implement custom token authentication with auth server . So i have used builder.Services.AddAuthenticatio in the FunctionStartUp, Am able to compile it . But while running in the local with the emulator.
When i call Http trigger functions am getting following error .
An unhandled host error has occurred.
Microsoft.AspNetCore.Authentication.Core: No authentication handler is registered for the scheme 'WebJobsAuthLevel'. The registered schemes are: BearerIdentityServerAuthenticationJwt, BearerIdentityServerAuthenticationIntrospection, Bearer. Did you forget to call AddAuthentication().AddSomeAuthHandler?.
Can some one help me on this please ???
Does azure functions support middlewares with the latest release ?
The text was updated successfully, but these errors were encountered: