2017-08-28 6 views
1

IDMを確認するには、ログインしているユーザーのアクティブセッションがありますか?ユーザーはIDMsrvでアクティブなセッションを持っていますか?

詳細 - ブラウザ 'X'からIDM上でアクティブなセッションがある場合、同じユーザー 'A'がブラウザ 'Y'を使用してログインしようとすると、予想される動作はユーザーにアクティブセッションがあり、ブラウザ 'X'セッション。暗黙の補助金 (生活identitytoken 30秒、とaspnetIdentity クライアントと

背景 -

IDMは、その後、私は、ユーザーを確認することができますIDM上で、いくつかの方法をヒットすると予想、ログインページに行くことなくトークン静かに更新アクセスを保持んアクセス権があるかどうか)!

答えて

0

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

関連する問題