Auto login by session id of main application to yii application as sub application.

I wanted to use yii application as sub application. So user can login to main application and when he will access to yii application. User need to auto login by credentials provided by main application.

Can anyone please suggest the best approach for doing this.

I am thinking of following approach.

  1. Main application will save session id to yii application with associated user.

  2. Session id will be verified by main application for security and session time out will be calculated by time when session id was inserted in application.

Thank you in advance