SimpleSAMLphp is an award-winning application written in native PHP that deals with authentication.