Hi folks,
I'm trying to implement a Java Service in order to validate user ids. The problem is that the UserProvider is not working as expected. Here is the code:
public boolean isUserNameValid(String userName) throws WebServiceException { User user = null; Set<String> users; try { if (userProvider == null) { userProvider = UserManagementAccessor.getUserProvider(); } // ALWAYS returns a User eventhough the API docs say "Returns the user which has the provided name, or nu user = userProvider.getUser(userName); // ALWAYS returns 'true' no matter if the user id exists on the HCP account or not boolean isValid = user.isValid(Calendar.getInstance()); // NEVER returns users eventhough I pass an exact userName that exists users = userProvider.searchUser(UserAttribute.NAME, userName, UserProvider.SearchOperator.EQUALS, UserProvider.CaseSensitive.NO); } catch (PersistenceException | IllegalStateException e) { throw new WebServiceException("An unknown error occured"); } return user != null; }
For whatever userId I request a user with the getUser function I get a User returned. And even worse this User object always looks precisely the same only differing in the user name which is the one I passed...
This way I see absolutely no way to validate if a user id is valid...
Is there some configuration or security implications I oversee?!
BR
Christian