This is an example User profile. The user ID is set in pageproperties jcr:createdBy

This is the user data in CRX stored. You need to fetch the user familyName and givenName.

Now when this user is creating a page userID will place in pageProperties.jcr:createdBy
Read this user ID and place it in Java code
UserManager userManager = request.getResourceResolver().adaptTo(UserManager.class);
Authorizable authorizable = userManager.getAuthorizable("userID");Now actually you will know the actual user profile path by
authorizable.getPath()Now resolve the resource and get the necessary values:
String fName = request.getResourceResolver().getResource(authorizable.getPath() + "/profile").getValueMap().get("givenName", "");
String lName = request.getResourceResolver().getResource(authorizable.getPath() + "/profile").getValueMap().get("familyName", "");
Note: You might not have access to read value under /home/users/ except for the administrator user role. In that case, you can create a service user instead of request.getResourceResolver() use only resourceResolver which has the permission of the service user.