Hello Tom
Thank you for your reply
Let me explain the situation again

Openstack auth doesn't use django models at all, it uses keystoneauth 
authorization logic

And this logic requires some data from request to recognize user
https://github.com/openstack/horizon/blob/master/openstack_auth/backend.py#L66

In case of default django function get_user shouldn't have an access to 
request because it uses django model to get a user but in case of openstack 
it's totally different

And unfortunately I see one way - patch django get_user method because we 
need it for django-websocket-redis uwsgi process

https://github.com/jrief/django-websocket-redis/blob/master/ws4redis/wsgi_server.py#L69

Right now the problem is in django-websocket-redis uwsgi process the user 
is always Anonymous because openstack auth is not able to recognize user 
due to the request absence in openstackauthbackend.

About my solution, well, I am happy to accept any ideas, my solution uses 
one of design patterns to solve a problem. Well, the problem is simple: we 
have few different packages which uses one class, but for some specific 
case this class should have an access to another object, for such purposes, 
there's a pattern Builder

https://sourcemaking.com/design_patterns/builder

As I said, I am happy to accept any comments, ideas how to solve it more 
properly

Thank you again for your time.

середа, 10 січня 2018 р. 14:17:50 UTC+1 користувач Tom Forbes написав:
>
> I think Tim’s assessment in the ticket is on point, a DjangoObjectBuilder 
> would look very strange and out of place if included (it’s not particularly 
> pythonic either). 
>
> Seems like there might be a legitimate issue here (or maybe just bad 
> designs in OpenStack?), but unless I’m misunderstanding something couldn’t 
> you call ‘auth_user.create_user_from_token’ yourself and set it on the 
> request object rather than monkeypatch Django?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f84a929a-eead-48ae-a6ce-114a3a635320%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to