Keep logged in accross Sites

78 views
Skip to first unread message

Pablo Camino Bueno

unread,
Jun 30, 2017, 9:06:24 AM6/30/17
to Django users
Hello,

I'm using Django Sites framework to hadle different sites, with the same users. 

I'd like to add a link to switch between my sites, but I don't want to get redirected to login view. What is the best way? should I add a view that logs the user in the destination site and redirect?

Constantine Covtushenko

unread,
Jul 1, 2017, 6:16:10 PM7/1/17
to django...@googlegroups.com
Hello Pablo,

+1 to your solution

Regards,
Constantine C.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@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/896d69c6-40da-4c85-bb0d-91c589ba7924%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

Pablo Camino Bueno

unread,
Jul 5, 2017, 7:25:22 AM7/5/17
to Django users, constan...@gmail.com
Hi Constantine,

Do you know how to implement this? I'd need to login the user in a domain that is not the one the view was reached from.

Could it be building a custom authentication backend that somehow logs the user in all the sites?




El domingo, 2 de julio de 2017, 0:16:10 (UTC+2), Constantine Covtushenko escribió:
Hello Pablo,

+1 to your solution

Regards,
Constantine C.
On Fri, Jun 30, 2017 at 9:06 AM, Pablo Camino Bueno <p.cam...@gmail.com> wrote:
Hello,

I'm using Django Sites framework to hadle different sites, with the same users. 

I'd like to add a link to switch between my sites, but I don't want to get redirected to login view. What is the best way? should I add a view that logs the user in the destination site and redirect?

--
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...@googlegroups.com.

Larry Martell

unread,
Jul 5, 2017, 8:53:19 AM7/5/17
to django...@googlegroups.com
On Wed, Jul 5, 2017 at 7:25 AM, Pablo Camino Bueno
<p.cam...@gmail.com> wrote:
> Hi Constantine,
>
> Do you know how to implement this? I'd need to login the user in a domain
> that is not the one the view was reached from.
>
> Could it be building a custom authentication backend that somehow logs the
> user in all the sites?

Sounds like you are talking about Single Sign On (SSO). Google that
and you will find many ways to implement that.

Constantine Covtushenko

unread,
Jul 6, 2017, 10:34:15 PM7/6/17
to django...@googlegroups.com
Hi Pablo,

As suggested Larry this can be like SSO implementation in one of sites hosted by your Django server.

But this can be done in more simple way because all sites are hosted within the same Django server.

Possible Workflow:
===============

Terms
--------
'SSO Site' - one of the sites which we should specify as main SSO server - main(central) application.
'Some Site' - any other site hosted on the same Django project except SSO site.

1. on Some Site user clicks 'Login'
2. SSO Site redirects user to soo view of SSO Site
3. sso view checks if user already logged in
4. if not redirects user on login page of SSO Site
5. sso view generates one time token and redirects user back on authenticate view of Some Site
6. authenticate view checks for token and if token valid and user was redirected from SSO Site retrieves user from that token and authenticate it into current session of Some Site.

I did not not find any way how to login user to all sites in advance. Session token stores in browser cookies and user authentication should be finished on the page that belongs to Some Site. User should initiate that login process either explicitly by clicking on 'Login' link or implicitly by redirecting from view that require authorization.

For the same reason I did not find how to request SSO from the page which is not belongs to domain for which user should be authenticated as you asked below.

Does it make any sense to you?

Regards,
Constantine C.
 

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages