When I get the user I don't get their credentials

Hello, a hand with this when I obtain the username the credentials are always null, it is possible to obtain the password through the user

public Usuario getUsuario(String username) {
		RealmResource realmResource = keycloak.realm(this.keyCloackPropierties.getRealm());
		UserRepresentation user =realmResource.users().search(username,true).get(0); 
		log.info("user {}->",jsonutil.toJson(user));//ok
		log.info("credentials {}->",user.getCredentials() );//:( is null!!!
		return this.keyCloackMap.map(user);
	}

log

e[2m2023-10-23T19:52:52.965-03:00e[0;39m e[32m INFOe[0;39m e[35m17524e[0;39m e[2m---e[0;39m e[2m[nio-8080-exec-1]e[0;39m e[36mc.w.keycloack.service.KeyCloackUsuarios e[0;39m e[2m:e[0;39m user {"id":"6f7a63c9-cbe7-41d1-951a-dc9334a04019","createdTimestamp":1698087165841,"username":"alice","enabled":true,"totp":false,"emailVerified":false,"firstName":"alice ","lastName":"test","email":"alice@gmail.com","disableableCredentialTypes":[],"requiredActions":[],"notBefore":0,"access":{"manageGroupMembership":true,"view":true,"mapRoles":true,"impersonate":true,"manage":true}}->
e[2m2023-10-23T19:52:52.965-03:00e[0;39m e[32m INFOe[0;39m e[35m17524e[0;39m e[2m---e[0;39m e[2m[nio-8080-exec-1]e[0;39m e[36mc.w.keycloack.service.KeyCloackUsuarios e[0;39m e[2m:e[0;39m credentials null->

dependency>
org.keycloak
keycloak-admin-client
22.0.4

java version 18

Can I bring the password or not?

No. You cannot retrieve a password for a user.

1 Like