Is there a pwauth equivalent for grafana to authenticate and assign roles?

Is there any way I can use a external authentication like pwauth script to do authentication and assign roles to users when they login to grafana ?