예제 #1
0
  /**
   * @param user
   * @param password
   * @return true if the user has superuser privileges.
   * @throws RemoteException If authentication fails.
   */
  public void authenticate(String username, String password) throws RemoteException {
    ConnectionConfig connConfig = getConnectionConfig();
    ConnectionInfo info =
        connConfig.getConnectionInfo(ConnectionInfo.DIRECTORY_SERVICE, username, password);
    if (info == null) throw new RemoteException("Incorrect username or password");

    HttpSession session = getServletRequestInfo().request.getSession(true);
    session.setAttribute(SESSION_USERNAME, username);
    session.setAttribute(SESSION_PASSWORD, password);
  }
예제 #2
0
 private static ConnectionInfo getColumnConnectionInfo(DataEntity entity) throws RemoteException {
   String connName = entity.privateMetadata.get(PrivateMetadata.CONNECTION);
   ConnectionConfig connConfig = getConnectionConfig();
   ConnectionInfo connInfo = connConfig.getConnectionInfo(connName);
   if (connInfo == null) {
     String title = entity.publicMetadata.get(PublicMetadata.TITLE);
     throw new RemoteException(
         String.format(
             "Connection named '%s' associated with column #%s (%s) no longer exists",
             connName, entity.id, title));
   }
   return connInfo;
 }
예제 #3
0
  public Map<String, Object> getServerInfo() throws RemoteException {
    ConnectionConfig connConfig = getConnectionConfig();
    HttpSession session = getServletRequestInfo().request.getSession(true);
    String username = (String) session.getAttribute(SESSION_USERNAME);

    return MapUtils.fromPairs(
        "version",
        WeaveConfig.getVersion(),
        "authenticatedUser",
        username,
        "hasDirectoryService",
        connConfig.getConnectionInfo(ConnectionInfo.DIRECTORY_SERVICE) != null,
        "idFields",
        connConfig.getDatabaseConfigInfo().idFields);
  }