Authorise a non Django User - python

I need to authorise a user on my Django powered site, but...
The user is not part of the Django user system (user table). However, I would it to behave like they have an active session just like they had logged like as a normal user.
Is this possible with Django, does Django support this sort of scenario?
I'm looking to be pointed in the right direction as I'm struggling to find information.

Well how are you going to authenticate the user if they are not in Django user system?
If there is another table or some other way you want to authenticate a user, you can write a custom authentication backend and plug it in. See django documentation on this.

Looks like django-lazysignup does exactly what you are looking for.

Related

Getting django accept phpBB users

My Problem is, I want to create a extra website on a phpBB forum to provide extra stuff and registration for meeting. No problem I know django and python, so this is no problem.
But I would be nice, if I could accept a session from a user or import the phpBB users so that they can login to my app.
I found django-phpBB, but I don't want to access the data. If I read correctly, my case is not the use case of django-phpBB.
Can anybody give me a good advice?

Python-social-auth returns admin user

I am trying to setup python-social-auth to authenticate users from Vk. I have a standard setup as written in docs with normal pipeline. The problem is that when user tries to log in:
'social.pipeline.social_auth.social_user',
always returns admin user. Basically, any user which tries to log in is associated with admin account. Any ideas why it happens and where to look at?!
Ok. I have found the answer. The problem was that I had already social auth association between UID and user which was recorded in DB. After removing the wrong association everything was working like a charm. Thanks to all who tried to help!

Adding custom attributes to django scheema

I am trying to authenticate my django application written in python with okta IDP. I have almost configured everything at SP side and IDP side too. Now I need to pass a custom variable from IDP which assert SP that user is a publisher,editor or admin and further save this to the django format database (in auth_user_groups table). Anyone have tried doing this, or anyone has idea about this?
I am able to get the custom variable values by attributes mappings from IDP. But this allows me to save the custom attributes only on the user table. please let me know if i have not made myself clear here about my question.
Once again I have a privilege to answer my own question. So hear is the solution.
Django has a user profile module which is to be turned on by giving the module location in the settings.py
i.e -
"AUTH_PROFILE_MODULE = appTitle.UserProfile"
The UserProfile needs to be specified in modules.py specifying the required structure of user profile u need for your app.
Now doing sync -db django creates the Database table for your user profile and further on the same user profile pysaml adds the value (CustomAttribute) which come on the saml Assertion.
more explanations on this can be found on django documentations too.
If any one still faces any issue please let me know.

user system with social authentication in django

I've read about a lot of different apps for django for integrating social authentication to django projects. But, I'm having some trouble understanding how this integration works
Does it extends the default USER models? Where do I find those kind of information in the applications?
I basically need a user system that has groups (for permission purposes). The user would be able to register using a common registration proccess or facebook. Will I be able to achieve that with any kind of application?
Thanks in advance.
There is an app called django-allauth. If you read their official documentation, it is pretty easy to follow. As per their instructions, you install the core app, and any other authentication you need (like facebook, oauth which google uses). Then, you have to go to facebook, get developers key, and add it to your django admin.
Basically, when somebody tries to login using facebook, the signin process sends the keys to facebook, and check if the user exists. If it does, then the authentication app creates user on the backend, just like a normal signin process. You can get javascript from facebook to make a login window.

User Types In Django using the same login and registration form

I've been hitting my head for the best way to implement this. I want to create two user type in my django site: Free and Premium users. Both users will register through the same registration form and login through the same login form. But will be able to view different content. Do you think #user_passes_test will be the best for this? Or what is the best way to implement this?
I've done something like this before. I utilized Django's contrib.auth groups system for this. You can create arbitrary permissions and then assign them to the various groups. You can then test to see if a given user has permissions for various actions. The permission required decorator is useful for this.

Categories