congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IgniteAuthenticationProcessor.addUser
Code IndexAdd Tabnine to your IDE (free)

How to use
addUser
method
in
org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor

Best Java code snippets using org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor.addUser (Showing top 20 results out of 315)

origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(0).context().authentication().addUser("test", "test");
    return null;
  }
}, IgniteException.class,
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(nodeIdx).context().authentication().addUser("test", "new_passwd");
    return null;
  }
}, UserManagementException.class, "User already exists");
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(CLI_NODE).context().authentication().addUser("test", "");
    return null;
  }
}, UserManagementException.class, "Password is empty");
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(CLI_NODE).context().authentication().addUser(null, "test");
    return null;
  }
}, UserManagementException.class, "User name is empty");
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(CLI_NODE).context().authentication().addUser("test", null);
    return null;
  }
}, UserManagementException.class, "Password is empty");
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(CLI_NODE).context().authentication().addUser(
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "a");
    return null;
  }
}, UserManagementException.class, "User name is too long");
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(nodeIdx).context().authentication().addUser("test1", "test1");
    return null;
  }
}, IgniteAccessControlException.class, "User management operations are not allowed for user");
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(CLI_NODE).context().authentication().addUser("", "test");
    return null;
  }
}, UserManagementException.class, "User name is empty");
origin: apache/ignite

  @Override public Object call() throws Exception {
    grid(CLI_NODE).context().authentication().addUser("test", passwd);
    return null;
  }
}, UserManagementException.class, "Invalid user name");
origin: apache/ignite

  @Override public void run() {
    AuthorizationContext.context(actxDflt);
    String user = "test" + usrCnt.getAndIncrement();
    try {
      for (int i = 0; i < ITERATIONS; ++i) {
        grid(CLI_NODE).context().authentication().addUser(user, "passwd_" + user);
        grid(CLI_NODE).context().authentication().removeUser(user);
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      fail("Unexpected exception");
    }
  }
}, 10, "user-op");
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testConcurrentFailedOperationNodeRestartServer() throws Exception {
  IgniteInternalFuture restartFut = loopServerRestarts();
  AuthorizationContext.context(actxDflt);
  grid(CLI_NODE).context().authentication().addUser("test", "test");
  GridTestUtils.runMultiThreaded(() -> {
    AuthorizationContext.context(actxDflt);
    try {
      while (!restartFut.isDone()) {
        GridTestUtils.assertThrows(log, () -> {
          grid(CLI_NODE).context().authentication().addUser("test", "test");
          return null;
        }, UserManagementException.class, "User already exists");
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      fail("Unexpected error on failed operation");
    }
  }, 10, "user-op");
  restartFut.get();
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testAddAlreadyExistsUser() throws Exception {
  AuthorizationContext.context(actxDflt);
  try {
    grid(0).context().authentication().addUser("test", "test");
    for (int i = 0; i < NODES_COUNT; ++i) {
      final int nodeIdx = i;
      GridTestUtils.assertThrows(log, new Callable<Object>() {
        @Override public Object call() throws Exception {
          grid(nodeIdx).context().authentication().addUser("test", "new_passwd");
          return null;
        }
      }, UserManagementException.class, "User already exists");
    }
  }
  finally {
    AuthorizationContext.context(null);
  }
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testConcurrentAddUpdateRemoveNodeRestartServer() throws Exception {
  IgniteInternalFuture restartFut = loopServerRestarts();
  AuthorizationContext.context(actxDflt);
  final AtomicInteger usrCnt = new AtomicInteger();
  GridTestUtils.runMultiThreaded(() -> {
    AuthorizationContext.context(actxDflt);
    String user = "test" + usrCnt.getAndIncrement();
    try {
      while (!restartFut.isDone()) {
        grid(CLI_NODE).context().authentication().addUser(user, "init");
        grid(CLI_NODE).context().authentication().updateUser(user, "passwd_" + user);
        grid(CLI_NODE).context().authentication().removeUser(user);
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      fail("Unexpected exception on add / remove");
    }
  }, 10, "user-op");
  restartFut.get();
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testUpdateUser() throws Exception {
  AuthorizationContext.context(actxDflt);
  try {
    grid(0).context().authentication().addUser("test", "test");
    AuthorizationContext actx = grid(0).context().authentication().authenticate("test", "test");
    for (int i = 0; i < NODES_COUNT; ++i) {
      for (int j = 0; j < NODES_COUNT; ++j)
        checkUpdateUser(actx, grid(i), grid(j));
    }
  }
  finally {
    AuthorizationContext.context(null);
  }
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testProceedUsersOnJoinNode() throws Exception {
  AuthorizationContext.context(actxDflt);
  try {
    grid(0).context().authentication().addUser("test0", "test");
    grid(0).context().authentication().addUser("test1", "test");
    int nodeIdx = NODES_COUNT;
    startGrid(nodeIdx);
    AuthorizationContext actx0 = grid(nodeIdx).context().authentication().authenticate("test0", "test");
    AuthorizationContext actx1 = grid(nodeIdx).context().authentication().authenticate("test1", "test");
    assertNotNull(actx0);
    assertEquals("test0", actx0.userName());
    assertNotNull(actx1);
    assertEquals("test1", actx1.userName());
  }
  finally {
    AuthorizationContext.context(null);
  }
}
origin: apache/ignite

/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
  super.beforeTest();
  U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", true);
  startGrids(2);
  grid(0).cluster().active(true);
  AuthorizationContext.context(grid(0).context().authentication().authenticate("ignite", "ignite"));
  grid(0).context().authentication().addUser("another_user", "passwd");
  AuthorizationContext.clear();
}
origin: apache/ignite

/**
 * @param createNode Node to execute create operation.
 * @param authNode Node to execute authentication.
 * @throws Exception On error.
 */
private void checkAddUpdateRemoveUser(IgniteEx createNode, IgniteEx authNode) throws Exception {
  createNode.context().authentication().addUser("test", "test");
  AuthorizationContext newActx = authNode.context().authentication().authenticate("test", "test");
  assertNotNull(newActx);
  assertEquals("test", newActx.userName());
  createNode.context().authentication().updateUser("test", "newpasswd");
  newActx = authNode.context().authentication().authenticate("test", "newpasswd");
  assertNotNull(newActx);
  assertEquals("test", newActx.userName());
  createNode.context().authentication().removeUser("test");
}
origin: apache/ignite

grid(0).context().authentication().addUser("test" + i, "passwd");
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testDefaultUserPersistence() throws Exception {
  AuthorizationContext.context(actxDflt);
  try {
    grid(CLI_NODE).context().authentication().addUser("test", "passwd");
    stopAllGrids();
    U.sleep(500);
    startGrids(NODES_COUNT);
    for (int i = 0; i < NODES_COUNT; ++i) {
      AuthorizationContext  actx = grid(i).context().authentication()
        .authenticate("ignite", "ignite");
      assertNotNull(actx);
      assertEquals("ignite", actx.userName());
      actx = grid(i).context().authentication()
        .authenticate("test", "passwd");
      assertNotNull(actx);
      assertEquals("test", actx.userName());
    }
  }
  finally {
    AuthorizationContext.clear();
  }
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testUserPersistence() throws Exception {
  AuthorizationContext.context(actxDflt);
  try {
    for (int i = 0; i < NODES_COUNT; ++i)
      grid(i).context().authentication().addUser("test" + i , "passwd" + i);
    grid(CLI_NODE).context().authentication().updateUser("ignite", "new_passwd");
    stopAllGrids();
    startGrids(NODES_COUNT);
    for (int i = 0; i < NODES_COUNT; ++i) {
      for (int usrIdx = 0; usrIdx < NODES_COUNT; ++usrIdx) {
        AuthorizationContext actx0 = grid(i).context().authentication()
          .authenticate("test" + usrIdx, "passwd" + usrIdx);
        assertNotNull(actx0);
        assertEquals("test" + usrIdx, actx0.userName());
      }
      AuthorizationContext actx = grid(i).context().authentication()
        .authenticate("ignite", "new_passwd");
      assertNotNull(actx);
      assertEquals("ignite", actx.userName());
    }
  }
  finally {
    AuthorizationContext.clear();
  }
}
org.apache.ignite.internal.processors.authenticationIgniteAuthenticationProcessoraddUser

Javadoc

Adds new user.

Popular methods of IgniteAuthenticationProcessor

  • authenticate
    Authenticate user.
  • removeUser
  • updateUser
  • addDefaultUser
  • addUserLocal
    Adds new user locally.
  • authenticateOnServer
    Authenticate user.
  • cacheProcessorStarted
    On cache processor started.
  • cancelFutures
  • checkActivate
    Check cluster state.
  • checkEnabled
  • coordinator
    Get current coordinator node.
  • enabled
  • coordinator,
  • enabled,
  • execUserOperation,
  • isLocalNodeCoordinator,
  • isNodeHoldsUsers,
  • onActivate,
  • onAuthenticateRequestMessage,
  • onAuthenticateResponseMessage,
  • onFinishMessage

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Collectors (java.util.stream)
  • JLabel (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now