Compute the userid and principals at runtime

I want to check the ipaddress with a database with ipaddress, userids and principals. With extra callbacks, I can implement this easy.