title: Sub domain Multi Tenant login with IdentityServer4
body: <p>i'm trying to implement multi tenant application with identityserver4 let's say i have </p>
  
  <ul>
  <li>web1.local.com  </li>
  <li>web2.local.com</li>
  </ul>
  
  <p>when i logged in to web1.local.com other domain which is web2.local.com also automatically logged in. </p>
  
  <p>is there anyway to separate these logins?</p>
  
  <p>i was thinking to have custom implementation of <code>IUserSession</code></p>
  
  <pre><code>public virtual async Task CreateSessionIdAsync(ClaimsPrincipal principal, AuthenticationProperties properties)
  {
      if (principal == null) throw new ArgumentNullException(nameof(principal));
      if (properties == null) throw new ArgumentNullException(nameof(properties));
  
      var currentSubjectId = (await GetUserAsync())?.GetSubjectId();
      var newSubjectId = principal.GetSubjectId();
  
      if (!properties.Items.ContainsKey(SessionIdKey) || currentSubjectId != newSubjectId)
      {
          properties.Items[SessionIdKey] = CryptoRandom.CreateUniqueId(16);
      }
  
      IssueSessionIdCookie(properties.Items[SessionIdKey]);
  
      Principal = principal;
      Properties = properties;
  }
  
  private void IssueSessionIdCookie(string sid)
  {
      if (Options.Endpoints.EnableCheckSessionEndpoint)
      {
          if (GetSessionIdCookieValue() != sid)
          {
              HttpContext.Response.Cookies.Append(
                  Options.Authentication.CheckSessionCookieName,
                  sid,
                  CreateSessionIdCookieOptions());
          }
      }
  }
  </code></pre>
  
  <p>what is the best approach ?</p>