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 On Mon, Jun 6, 2016 at 10:55 PM, prabhat jha <prabhat.jha....@gmail.com> wrote: > hey bro thanx,but i am not using django authentication pattern. > so @login required will not work in my condition. > >> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/ab5a26dc-16a8-4638-9350-8f8ad26bf83d%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/ab5a26dc-16a8-4638-9350-8f8ad26bf83d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGq7Khri22_2F7X%2B_R6ZTvwFHnKpSroN6784UeKhZXijWc%3DKQQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.