Weiterleitung zu ReturnUrl nach erfolgreicher Cookie-Authentifizierung in Owin, Katana & Nancy
Ich verwende Owin, Katana und Nancy, um eine einfache Site mit einem Abschnitt zu hosten, der eine Authentifizierung erfordert. Hinweis: Ich verwende auch das Nuget-Paket.Nancy.MSOwinSecurity
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = Constants.AuthenticationType,
LoginPath = new PathString("/Login"),
});
app.UseNancy();
Hier ist mein Modulcode
public class LoginModule : NancyModule
{
public LoginModule()
{
Post["login"] = p =>
{
var name = Request.Form.name;
var auth = Context.GetAuthenticationManager();
var claims = new List<Claim> {new Claim(ClaimTypes.Name, name)};
var id = new ClaimsIdentity(claims, Constants.AuthenticationType);
auth.SignIn(id);
// redirect how????
return View["index"];
};
}
}
Mein Einreichungsformular
<form name="login" action="/login" method="post" accept-charset="utf-8">
<ul>
...
</ul>
</form>
Nun freue ich mich nach erfolgreicher Anmeldung auf die ReturnUrl umzuleiten -
z.B. Anmelden? ReturnUrl =% 2Fblah% 2blahblah
Es scheint keine Umleitungsmethode wie bei der Formularauthentifizierung zu geben, und die Eigenschaft Parameter für Abfragezeichenfolgen ist leer.