Hello,
Kamailio default configuration file provides samples on how to configure a simple VoIP provider.
regarding SIP trunking it has examples for: user authentication and IP authorization.
In order to enable user authentication you need to define:
#!define WITH_MYSQL
#!define WITH_AUTH
This will enable MySQL DB back-end support and auth and auth_db modules. You should have MySQL server configured with a database required by kamailio and create subscribers with username, passwords.
After that you can register a SIP client with username/password previously created.