Brock has already mentioned about it, It should be at the time of login and logout
それはなぜそのないIdmの中で、意味をなします。少なくとも今後のバージョンではこれを拡張機能として提供することは間違いありません。
Profile ServiceのIsActiveメソッドは、authorizeによってヒットしたもので、 tokenvalidationエンドポイントです。
ログイン時にセッションが持続すると、上記のコードヒットはビジネス要件ごとにチェックします。
セッションがアクティブ(クッキーライフタイム)である限り、サイレント認証はアプリケーションロジックに渡されます。クッキーライフタイムによっても制御できます。
public override async Task IsActiveAsync(IsActiveContext context)
{
var sub = context.Subject.GetSubjectId();
var user = await userManager.FindByIdAsync(sub);
//Check existing sessions
if (context.Caller.Equals("AccessTokenValidation", StringComparison.OrdinalIgnoreCase))
{
if (user != null)
context.IsActive = !appuser.VerifyRenewToken(sub, context.Client.ClientId);
else
context.IsActive = false;
}
else
context.IsActive = user != null;
}
public async Task<IActionResult> Login(LoginInputModel model)
{
if (ModelState.IsValid)
{
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberLogin, false);
if (result.Succeeded)
{
//Update security stamp to invalidate existing sessions
//TODO: This didn't invalidate the existing cookie from another client
//var test= _userManager.UpdateSecurityStampAsync(_userManager.FindByEmailAsync(model.Email).Result).Result;
appUser.PersistSession(new UserSession
{
CreatedOn = DateTimeOffset.Now,
DeviceUniqueId = GetDeviceId(),
UserId = _userManager.FindByNameAsync(model.Email).Result.Id,
SId = httpContext.HttpContext.Session.Id,
ClientId= httpContext.HttpContext.Request.QueryString.Value.GetClientIdFromQuery(),
ExpiresOn = DateTimeOffset.Now.AddMinutes(appSettings.SessionTimeOut)
});
_logger.LogInformation(1, "User logged in.");
return RedirectToLocal(model.ReturnUrl);
}
このメソッドは、IISを再起動しますいくつかの欠点を持っており、ユーザーが適切に署名していない場合はサインイン。
これは最適な選択肢ではありませんが、これは最適ではありません。
更新:
@tibold
refer here duplicate/similar question
idmsrv endpoints are missing security change check
Issue raised
Should be like this
出典
2017-09-04 00:20:40
Jay