You extend modPrincipal and override the method in your custom User class. There is a ticket already in to address this so it’s not necessary, but for now, you’ll have to maintain the hack or extend modUser.
A while ago I created a custom database table its records had been secured with the core access control system of modx revolution.
For this I changed the modPrincipal core class to load the attributes for my component.
See: http://modxcms.com/forums/index.php/topic,49629.msg289509.html#msg289509
Now I wanted to ask how would it be possible to approach this without hacking the core.
How can I properly extend the modPrincipal class?
Thanks

class customSecurity extends modPrincipal {
public function getAttributes() {
…method content to load attributes for custom component…
}
}
You extend modPrincipal and override the method in your custom User class
Correct.
Does it mean I have to create a class that extends modUser like: "class customSecurity extends modUser" and in this class I need to have the custom getAttributes-method?
$x = $modx->getService('extendeduser','Sampleclass',$modx->getOption('core_path',null, MODX_CORE_PATH).'components/extendeduser/',$scriptProperties);
if (!($x instanceof Extendeduser)) {
$modx->log(modX::LOG_LEVEL_ERROR,'[Extendeduser] Could not load Extendeduser class.');
$modx->event->output(true);
}
return;