Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use this project in my app #4

Open
shbz1690 opened this issue May 17, 2017 · 1 comment
Open

how to use this project in my app #4

shbz1690 opened this issue May 17, 2017 · 1 comment

Comments

@shbz1690
Copy link

Hey, Sorry this question looks stupid but I am new to django , and I created a simple app mysite by running the command in my django1.10 version:

django-admin.py startproject mysite

I tested my app by running ** python manage.py runserver ** , and it is running fine and when I go to the URL
http://127.0.0.1:8000/admin/login/?next=/admin/ , it shows me a admin login box , which I think by default created when i created my django app and run the DB migration.

Now I want to use your module in my app so when I go to login url , it should ask me the username and pwd for the idp.

So I installed your package by running ** sudo python setup.py install **

Now I dont know how I can use this in my Django app, where do i need to import this package.

I added below code to my setting.py:

AUTHENTICATION_BACKENDS = (
# 'django.contrib.auth.backends.ModelBackend',
'saml_service_provider.auth_backend.SAMLServiceProviderBackend',
)

But what after this ?

where do I need to add below code (in your view.py or url.py , or in my view.py or url.py ):

class SettingsMixin(object):
def get_onelogin_settings(self):
return OneloginServiceProviderSettings(
onelogin_connector_id=1234,
onelogin_x509_cert="""-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----""",

        sp_metadata_url="http://localhost:8000%s" % reverse("saml_metadata"),
        sp_login_url="http://localhost:8000%s" % reverse("saml_login_complete"),
        sp_logout_url="http://localhost:8000%s" % reverse("logout"),

        debug=settings.DEBUG,
        strict=not settings.DEBUG,

        sp_x509cert="""-----BEGIN CERTIFICATE-----
    -----END CERTIFICATE-----""",
        sp_private_key="""-----BEGIN RSA PRIVATE KEY-----
    -----END RSA PRIVATE KEY-----"""
        ).settings

class LoginView(SettingsMixin, InitiateAuthenticationView):
pass

class Authenticateview(SettingsMixin, CompleteAuthenticationView):
pass

class XMLMetadataView(SettingsMixin, MetadataView):
pass

==================================================================

can you please help me out into this ..

@RevolutionTech
Copy link

The setup for django-saml-service-provider is a bit complicated. To simplify the setup process a bit for users that have OneLogin as an identity provider I created #12.

This repo has not been updated in some time though, so that PR might never get merged in. If that's the case, feel free to use our fork:
https://github.com/infoscout/django-saml-service-provider

You can add:

git+ssh://[email protected]/infoscout/[email protected]#egg=django-saml-service-provider==2.0.0

to your requirements.txt file, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants