Using Wordpress For User Authentication

I’m trying to integrate an existing Yii app into WordPress, and wanting to use WP for user access control (via the S2Member plug-in).

Is there a simple way (code snippet/extension) to make Yii refer to WordPress for its user authentication?

I’ve managed to make my app retrieve user info in the site (by including wp-load.php in yii boostrap), but this is not really access control…

How would I go about overriding the CUserIdentity to :

  • use WordPress to login/logout (eg wp_loginout() function)?

  • use WP user information for Yii user class?

  • use WP role/capability info to control access to pages (in access filters)?

… and if it doesn’t exist, surely this is an extension worth developing!