Customize SSO for certain users

@mathiasconradt
Let me try to explain it with an example:
I have some users in a company say “company1” with the username of “user1@company1.com”.
I have a user from the same company who doesn’t have the company domain name and have a username say “user2@gmail.com”. I want to enable SSO for only those users who have “company1.com” in their username and for others, I can have simple basic authentication. How can I achieve this?