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

FOS throws NotSupportedException when using Microsoft.Owin.Security middlewares #9

Open
mikdav opened this issue May 16, 2018 · 7 comments

Comments

@mikdav
Copy link

mikdav commented May 16, 2018

Wired up a test application with UseActiveDirectoryFederationServicesBearerAuthentication, and get the following exception:

System.NotSupportedException: The OWIN key 'server.OnSendingHeaders' is not available for this request.
at Microsoft.Owin.OwinResponse.OnSendingHeaders(Action1 callback, Object state) at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<BaseInitializeAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware1.d__0.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.NotSupportedException: The OWIN key 'server.OnSendingHeaders' is not available for this request.
at Microsoft.Owin.OwinResponse.OnSendingHeaders(Action1 callback, Object state) at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<BaseInitializeAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown ---<br /> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware1.d__0.MoveNext()

The FosRequest class would need to be able to handle the common key server.OnSendingHeaders (defined here: http://owin.org/spec/spec/CommonKeys.html#_6._Common_keys) in order to use these middlewares.

@mikdav
Copy link
Author

mikdav commented May 16, 2018

Committed possible change in d7e9575

@mikdav
Copy link
Author

mikdav commented May 16, 2018

Verified that I can now use MS Auth middlewares and all unit tests pass.

@mzabani
Copy link
Owner

mzabani commented May 18, 2018

This is really great! If you're willing to submit a Pull Request, I'll accept it right away!

@mikdav
Copy link
Author

mikdav commented May 18, 2018

Have you had a chance to look at dbd5a64 that fixes #8? I know it is a bit heavier change because it takes a new dependency on Microsoft.Owin and ups the framework version. However, I needed webapi before I needed the auth, so I committed it first. Just need to know whether you want a pull request for both or if I need to branch. Thanks.

@mzabani
Copy link
Owner

mzabani commented May 24, 2018

I don't mind taking a dependency on Microsoft.Owin, but it upping the framework version really necessary?

@mikdav
Copy link
Author

mikdav commented May 24, 2018

Unfortunately the last version of Microsoft.Owin that supported .Net 4 was 2.1.0 which is more than 4 years old and two major versions ago. Everything since then has required .Net 4.5. So, don't need to go all the way to 4.62, but probably should at least consider 4.5. I have not tested my changes with Microsoft.Owin 2.1.0.

@mzabani
Copy link
Owner

mzabani commented Jun 5, 2018

Sorry for taking so long to respond, I thought I already had replied to this.
I don't believe requiring .NET 4.5 would be a problem at this point. What do you think?

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

No branches or pull requests

2 participants