Login from custom API?

Thanks @dan.woda ! It absolutely answers my question.

However I think I found an other possible solution. Do you think we could use Pre-User Registration Hook to implement username validation ? Pre-User Registration
This way we would get rid of our own registration system and handle this directly from the universal login.
Would that work to you? What is the best solution to you?