Ich habe eine OWIN-Middleware zur Authentifizierung. Wir verfügen über zwei Arten der Authentifizierung.
Der erste Typ ist ein Inhabertoken mit der folgenden Konfiguration
Code: Select all
var OAuthOptions = new OAuthAuthorizationServerOptions
{
AuthenticationType = DefaultAuthenticationTypes.ExternalBearer,
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
AllowInsecureHttp = true,
AccessTokenFormat = new SecureTokenFormatter(GetMachineKey())
};
Und zweiter Typ verwendet Authentifizierungs-Cookie für die externe Anmeldung
Code: Select all
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive,
CookieHttpOnly = true,
CookieSecure = CookieSecureOption.SameAsRequest,
CookieName = ".AspNet." + DefaultAuthenticationTypes.ExternalCookie,
ExpireTimeSpan = TimeSpan.FromMinutes(5),
TicketDataFormat = new SecureTokenFormatter(GetMachineKey())
});
Bei der Benutzerabmeldung führen wir tatsächlich zwei Abmeldungen aus
Code: Select all
Request.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
Und
Code: Select all
Request.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ExternalBearer);
Beim ersten erwarte ich, dass das .AspNet.ExternalCookie-Cookie aus dem Browser gelöscht wird, was nicht der Fall ist.
Beim zweiten erwarte ich, dass das Cookie .AspNet.ExternalCookie aus dem Browser gelöscht wird Ich erwarte, dass mein Token ungültig wird und die User.Current.Identity = null ist, was nicht der Fall ist.
Wie kann ich also
1) mich physisch vom Strom abmelden? Identität für die aktuelle Sitzung?
2) Das externe Cookie aus dem Browser entfernen?
Ich habe eine OWIN-Middleware zur Authentifizierung. Wir verfügen über zwei Arten der Authentifizierung.
Der erste Typ ist ein Inhabertoken mit der folgenden Konfiguration
[code]var OAuthOptions = new OAuthAuthorizationServerOptions
{
AuthenticationType = DefaultAuthenticationTypes.ExternalBearer,
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
AllowInsecureHttp = true,
AccessTokenFormat = new SecureTokenFormatter(GetMachineKey())
};
[/code]
Und zweiter Typ verwendet Authentifizierungs-Cookie für die externe Anmeldung
[code]app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive,
CookieHttpOnly = true,
CookieSecure = CookieSecureOption.SameAsRequest,
CookieName = ".AspNet." + DefaultAuthenticationTypes.ExternalCookie,
ExpireTimeSpan = TimeSpan.FromMinutes(5),
TicketDataFormat = new SecureTokenFormatter(GetMachineKey())
});
[/code]
Bei der Benutzerabmeldung führen wir tatsächlich zwei Abmeldungen aus
[code]Request.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
[/code]
Und
[code]Request.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ExternalBearer);
[/code]
Beim ersten erwarte ich, dass das .AspNet.ExternalCookie-Cookie aus dem Browser gelöscht wird, was nicht der Fall ist.
Beim zweiten erwarte ich, dass das Cookie .AspNet.ExternalCookie aus dem Browser gelöscht wird Ich erwarte, dass mein Token ungültig wird und die User.Current.Identity = null ist, was nicht der Fall ist.
Wie kann ich also
1) mich physisch vom Strom abmelden? Identität für die aktuelle Sitzung?
2) Das externe Cookie aus dem Browser entfernen?