Re: [Cppcms-users] Cppcms-users Digest, Vol 14, Issue 14
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-09-24 13:49:50
|
> Good morning Artyom. > >I have a question and I was trying to see if you might have a suggestion. > >I am building an application using cppcms, but part of my application involved >email and forums. I am planning to utilize phpbb for the forums, but the issue >I'm having, is that I only want the user to sign in once. > >So, user logs in, the default page is in the cppcms realm, they click on a link >to go to the forums. Any ideas how I would handle this? I'm running this >behind nginx, but from what I understand, session information is in cppcms, and >can't be accessed by phpbb. I could maybe modify phpbb's login code to instead >pull from a database or something, but I was wondering if there isn't something >simpler. One thing I thought about was maybe posting the login data to the >phpbb module (like through a url redirect) but I'm not confident in that. > > >Basically, cppcms gives my application so much more that I need that PHP can >not. However, I would like to cut down development time on features that exist >in open source locations, but most of those will utilize PHP. But I want to >present only 1 sign in for the user. > Basically you need to share some session information between phpbb (BTW great forum) and the CppCMS. I think the simplest would be to create a signed cookie that holds the username that marks that it was verified against the DB. I.e. you need a cookie that holds: 1. Some expiration date 2. User name 3. Signature (HMAC) Now, you would need to change PhpBB login to set such cookie (and probably renew its expiration) On the CppCMS side you would need to verify it. And of course both CppCMS Application and phpBB would need to adopt themselves for such cooperation. See following, <cppcms/crypto.h> for HMAC signature on CppCMS side PHP 5.1: hash_hmac http://us2.php.net/manual/en/function.hash-hmac.php And of course they should share same secret key. I don't think there is easier way to do. What is basically you need to implement a shared session and this is the easiest way to do this. Artyom |