title: GWT-RPC: cannot use javax.security.auth.Subject on server-side
body: <p>I'm trying to implement an RPC-authorization service for my GWT/GWTP app, but I've got some problems. Intellij IDEA treats this using of Subject class on the server-side like an error:     </p>
  
  <p><code>Class 'javax.security.auth.Subject' is not present in JRE Emulation Library so it cannot be used in client mode</code></p>
  
  <p>Here is the code snippet:</p>
  
  <pre><code>import javax.security.auth.Subject;
  
  public class LoginServiceImpl extends RemoteServiceServlet implements LoginService {
      public void loginUser(String login, String password) {
          Subject subject = UserContext.createSubject(connection, login, password, null);
      }
  }
  </code></pre>
  
  <p>Why it mentions the 'client mode' when I'm trying to use this class on the server-side?
  And it doesn't complain about that:</p>
  
  <pre><code>public class LoginServiceImpl extends RemoteServiceServlet implements LoginService {
      public void loginUser(String login, String password) {
           UserContext.get().pushSubject(
              UserContext.createSubject(connection, login, password, null)
           );
      }
  }
  </code></pre>
  
  <p>Why IDEA treats the former like an error but doesn't complain about the latter?</p>