Assuming you are talking about logging in from PHP code running in the DSP context. If so, then have a look at the lib-php-common-platform library /src/Resources/User/Session.php:userLogin() and /src/Services/SystemManager.php:autoLoginAdmin(). I am not sure if you want the actual session info generated or just a logged user, either way this should give you some ideas.