Comments (6)
Nevermind, I seem to have resolved this issue. I was setting my CookieAuthenticationOptions like so:
new CookieAuthenticationOptions()
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/account/login"),
Provider = new CookieAuthenticationProvider()
{
OnApplyRedirect = ctx =>
{
if (!ctx.Request.IsNtlmAuthenticationCallback())
{
ctx.Response.Redirect(ctx.RedirectUri);
}
}
}
}
The problem seemed to be specifying the LoginPath
. When I removed this option, everything worked correctly. Perhaps it's a cross-origin type issue related to specifying the CallbackPath
PathString with the virtual directory (i.e. /<appname>/authentication/ntlm-signin
), whereas the LoginPath
did not contain the virtual directory (i.e. /account/login
).
from pysco68.owin.authentication.ntlm.
A follow up on this issue and how I actually ended up resolving it... Since I specified a CallbackPath
in the NtlmAuthenticationOptions
I also needed to call IsNtlmAuthenticationCallback
with the redirectPath
overload in the following manner:
OnApplyRedirect = ctx =>
{
if (!ctx.Request.IsNtlmAuthenticationCallback(CallbackPath))
{
ctx.Response.Redirect(ctx.RedirectUri);
}
}
If CallbackPath
is not specified then IsNtlmAuthenticationCallback
makes the comparison using the NtlmAuthenticationOptions.DefaultRedirectPath
(/authentication/ntlm-signin
), which does not work for an app under a virtual directory (/<virtual_directory>/authentication/ntlm-signin
).
This could be a helpful tip to add to the documentation for those running apps under virtual directories.
from pysco68.owin.authentication.ntlm.
It sure would be helpful, I'll try to take care of this asap!
Thank you very much for the follow-up!
from pysco68.owin.authentication.ntlm.
Added note: 901c8c7
from pysco68.owin.authentication.ntlm.
I'm having this same issue, but when I drop LoginPath from UseCookieAuthentication then it doesn't attempt to log the user in.
from pysco68.owin.authentication.ntlm.
Finally figured out how to do this and it should work dynamically....
public void Configuration(IAppBuilder app)
{
var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
app.SetDefaultSignInAsAuthenticationType(DefaultAuthenticationTypes.ApplicationCookie);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Login"),
Provider = new CookieAuthenticationProvider()
{
OnApplyRedirect = ctx =>
{
if (!ctx.Request.IsNtlmAuthenticationCallback(new PathString(urlHelper.Action("authentication", "ntlm-signin"))))
{
ctx.Response.Redirect(ctx.RedirectUri);
}
}
}
});
app.UseNtlmAuthentication(new NtlmAuthenticationOptions()
{
CallbackPath = new PathString(urlHelper.Action("authentication", "ntlm-signin"))
});
}
from pysco68.owin.authentication.ntlm.
Related Issues (16)
- CallbackPath check fails when BasePath is not /
- Prompted for credentials HOT 1
- Authorization header always missing HOT 8
- You should port to .net core HOT 1
- IOwinRequest in OnCreateIdentity callback HOT 2
- Why Owin.Extensions and Owin.Types are referenced? HOT 2
- Configuration of CallbackPath not working as expected HOT 2
- The identity in RequestContext.Principal.Identity does not provide domain name HOT 5
- Retrieve User Identity [Question] HOT 4
- NTLM authentication works well on IIS Express (Visual Studio) but fails on IIS. HOT 4
- HandshakeState.IsClientResponseValid failed while accesing specific domain instead localhost
- when to send challenge with SignalR? HOT 2
- Feature request: give me a hook for rejecting particular users HOT 5
- possible to use token instead of cookie? HOT 1
- Sample using this Nuget package HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysco68.owin.authentication.ntlm.