I am trying to set a username/password combination programatically:
HashLoginService loginService = new HashLoginService();
loginService.setName("myrealm");
Credential credential = new Password("password");
AbstractLoginService.UserPrincipal principal =
new AbstractLoginService.UserPrincipal("username",credential);
Subject subject = new Subject();
subject.getPrincipals().add(principal);
subject.getPrivateCredentials().add(credential);
loginService.getIdentityService().newUserIdentity(
subject,
principal,
new String[]{"users"});
Yet I am getting 401. What do I miss here? Used to be able to do simple
loginService.putUser("username",
new Password("password"),
new String[]{"users"});
but not with jetty 9.
Would appreciate some guidance. Thank you!