I'm trying to create a new user using X-Pack Java API:
final PutUserRequest putUserRequest = new PutUserRequest(); putUserRequest .enabled(true); putUserRequest .username("userName"); putUserRequest .fullName("userFullName"); putUserRequest .passwordHash("password".hashCode()); putUserRequest .email("firstname.lastname@example.org"); putUserRequest .roles("kibana_user"); final XPackClient xPackClient = new XPackClient(transportClient); xPackClient.security().putUser(putUser, null);
The user is created but when I try to log in I'm getting wrong password message. I've tried multiple ways to calculate the password hash, and sizes, but still not working.
How should the passwordHash be generated?