cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2242
Views
0
Helpful
1
Replies

SAML SSO Authentication with Django REST Framework

leviya
Level 4
Level 4

I'm currently working on a AngularJS front-end and Django REST back-end. I've been using django-rest-auth in the past to authenticate my connections between the two, but I now have to integrate a SSO authentication using SAML.

I've looked around and decided to use python3-saml, but any of the documentation and use case examples (for this package and any other) are applied for pure Django applications.


I've been basing myself on OneLogin's django/flask guide and I tried making a custom Middleware that would catch my requests, but the implementation of the redirects provided by OneLogin does not work with REST call (obviously). I've also seen some people using the AUTHENTICATION_BACKENDS Django setting and I'm wondering if it's maybe more what I'm looking for.

Thank you

1 Reply 1

stevediaz
Level 1
Level 1

Hello

Follow below steps : 

  1. Choose a Python SAML library like python3-saml for Django.
  2. Implement SAML authentication in your AngularJS front-end using a compatible library like angular-saml2.
  3. For REST API calls, use token-based authentication (e.g., JWT) along with SAML for initial user login.
  4. Configure Django's AUTHENTICATION_BACKENDS setting to handle SAML authentication in the back-end.
  5. Ensure the SAML library supports Python 3 and your specific use case.

Thank you.