Two options:
1. Tie into Django Authentication
You can make a custom authentication backend and do whatever you want for authentication -- including talk over a named pipe and get the OK for users if you like.
With that you'll be able to use the login_required decorator. To make a authentication backend you will also need some kind of User object to pass to the built-in login and logout functions -- which take care of marking the session appropriately.
Of course that bring up a couple other things like storing your session data -- I presume it is happening currently a cached session then? Or is there a solution for getting sessions data elsewhere? Anyway typically only the session-id is stored in the cookie and the value is a pickled dictionary if you need to dig into that.
2. c++ is handling users, and auth... and maybe sessions
It sounds like this may be your situation. In which case the appropriate thing to do is to decorate your
view functions to check if the requesting session is logged in, and
either redirect to login or call the view function decorated. You could use memcache or something like that to store login creds somewhere django can read them directly -- otherwise you'll probably be calling out to your named pipe on every request to one of these views.
From what I'm reading you'd want something like this -- where you fill in a function to call out to your named pipe in 'named_pipe_auth_ok'.
def my_required_login(view_func):
def return_func(*args, **kwargs):
assert args[0]
request = args[0]
session_id = request.session.session_id
if named_pipe_auth_ok(session_id):
return view_func(*args, **kwargs)
else:
return redirect('/some/login/url')
return return_func
Sounds like fun, cheers,
Daniel