나는 identityserver에 의해 관리되는 권한을 가진 MVC 응용 프로그램을 가지고 있습니다. 처음 웹에 액세스하면 identityserver 로그 페이지로 리디렉션되며 웹에 다시 리디렉션됩니다.자동 로그인을 비활성화하는 방법 IdentityServer
내 문제는 아이디 서버를 로그 아웃하면 아이디 서버 권한으로 아이디 서버로 리디렉션됩니다.하지만 아이디 입력없이 사용자 웹에 액세스 할 수있게됩니다.
나는 쿠키가 클라이언트에서 여전히 살아 있기 때문에 (나는 내 브라우저에서 수동으로 모든 쿠키를 삭제 한 다음 사용자/패스가 필요하다) 때문이다.
어떻게 자동 로그인을 비활성화 할 수 있습니까? (사용자/패스가 항상 필요합니다)?
내 시작 클라이언트 구성과 같은 것입니다 : 사전에
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
LoginPath = new PathString("/Home/Logged/"),
AuthenticationType = "Cookies",
ExpireTimeSpan = TimeSpan.FromDays(2),
SlidingExpiration = true,
CookieName = ".AspNet.MyApp"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
ClientId = "MyApp",
Authority = IS_URL,
RedirectUri = localHostURL + "/Home/Logged/",
PostLogoutRedirectUri = localHostURL + "/Account/Login/",
ResponseType = "code id_token token",
Scope = "openid profile read write sampleApi",
SignInAsAuthenticationType = "Cookies",
UseTokenLifetime = true,
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = async n =>
{
var nid = new ClaimsIdentity(
n.AuthenticationTicket.Identity.AuthenticationType,
"given_name",
"role");
// get userinfo data
var userInfoClient = new UserInfoClient(
new System.Uri(n.Options.Authority + "/connect/userinfo"),
n.ProtocolMessage.AccessToken);
var userInfo = await userInfoClient.GetAsync();
userInfo.Claims.ToList().ForEach(ui => nid.AddClaim(new Claim(ui.Item1, ui.Item2)));
//keep the id_token for logout
nid.AddClaim(new Claim("id_token", n.ProtocolMessage.IdToken));
// add access token for sample API
nid.AddClaim(new Claim("access_token", n.ProtocolMessage.AccessToken));
// keep track of access token expiration
nid.AddClaim(new Claim("expires_at", TimeSpan.FromDays(2).ToString()));
// add some other app specific claim
nid.AddClaim(new Claim("app_specific", "some data"));
n.AuthenticationTicket = new AuthenticationTicket(
nid,
n.AuthenticationTicket.Properties);
},
RedirectToIdentityProvider = n =>
{
if (n.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest)
{
var idTokenHint = n.OwinContext.Authentication.User.FindFirst("id_token");
if (idTokenHint != null)
{
n.ProtocolMessage.IdTokenHint = idTokenHint.Value;
}
}
return Task.FromResult(0);
}
}
});
감사합니다!