Skip to main content

Dataporten is an authentication, authorization and API platform for higher and lower education and research in Norway. Dataporten offers authentication of users to applications using OAuth 2.0 and the OpenID Connect.

Dataporten-auth is a client for dataporten that depends on python-social-auth.

Installation

Install with pip or by downloading the source and running setup.py.

Usage

There needs to exist an entry for your site/app at dataporten. Log in to dataporten’s dashboard and create an application.

You’ll need to set the client id and client secret in the settings of your app/site, while the application at dataporten will need one or more redirect uris.

Both the name of the settings and the redirect uris depend on the plugins used. Add at least one of the plugins below. See python-social-auth’s documentation for how.

The redirect uri is of the form <type>://<domainpath>/<suffix>/, where <type> is one of http or https, <domainpath> is the domain name of your site and an optional path, and the <suffix> is plugin-dependent. See the examples.

You can have several redirect-uris, and you will be needing at least one per plugin used.

dataporten.psa.DataportenOauth2

Plugin name

dataporten.psa.DataportenOauth2

Settings

Client id: SOCIAL_AUTH_DATAPORTEN_KEY

Client secret: SOCIAL_AUTH_DATAPORTEN_SECRET

Scopes needed

userid and profile, this is the default.

Username generated:

Unique, alphanumeric string. You might want to let users change this generated username. The plugin only cares that a username exists and won’t change the username back.

Redirect-uri ends with

/complete/dataporten/

Example redirect uri:

http://127.0.0.1/complete/dataporten/

dataporten.psa.DataportenEmailOauth2

Plugin name

dataporten.psa.DataportenEmailOauth2

Settings

Client id: SOCIAL_AUTH_DATAPORTEN_EMAIL_KEY

Client secret: SOCIAL_AUTH_DATAPORTEN_EMAIL_SECRET

Scopes needed

email, this must be explicitly allowed in the dashboard.

Username generated:

From email-address

Redirect-uri ends with

/complete/dataporten_email/

Example redirect uri:

https://supersites.exmaple.net/mysite/complete/dataporten_email/

dataporten.psa.DataportenFeideOauth2

Plugin name

dataporten.psa.DataportenEmailOauth2

Settings

Client id: SOCIAL_AUTH_DATAPORTEN_FEIDE_KEY

Client secret: SOCIAL_AUTH_DATAPORTEN_FEIDE_SECRET

Scopes needed

userid-feide, this must be explicitly allowed in the dashboard.

Username generated:

From the Feide attribute eduPersonPrincipalName, which looks like an email address.

Redirect-uri ends with

/complete/dataporten_feide/

Example redirect uri:

https://example.com/cheatsheet/complete/dataporten_feide/

Demo

  1. Get the source code

  2. Install dependencies: pip install -r requirements/demo.txt

  3. Make an application at dataporten

  4. Edit the settings-file to set SOCIAL_AUTH_DATAPORTEN_KEY and SOCIAL_AUTH_DATAPORTEN_SECRET

  5. Set three redirect-uris, all starting with http://127.0.0.1:8000

  6. Run python mange.py runserver

  7. Visit http://127.0.0.1:8000 in a fresh browser. Log out doesn’t work (yet), so to reset, delete the file db.sqlite3 and run python mange.py runserver again

Optionally, you can add other python-social-auth plugins as well.

Version:

0.1.1

Metadata

Release files for dataporten-auth 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataporten-auth 0.1.1
File Size Uploaded
dataporten-auth-0.1.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dataporten-auth 0.1.1
File Interpreter ABI Platform
dataporten_auth-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.5 kB

Release files / dataporten-auth-0.1.1.tar.gz

Download URL dataporten-auth-0.1.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1d208e133eac4aeb804b17374519aec9ad51ca8ee192a0b8f3a3fcc1943ae85d
BLAKE2b-256 checksum
How to use checksums
7e555dd5b60752d9b93bf81e4b8b88ecac0f9f3a728bc7a0eee444b0748399b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dataporten_auth-0.1.1-py2.py3-none-any.whl

Download URL dataporten_auth-0.1.1-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
65da976467cd6ab53baeef6970bb0127c9e5f7dcd1c8fd72e4957159c4eee908
BLAKE2b-256 checksum
How to use checksums
ce7a565e22ff7552675bca1e852dcab097d181495b7e9014ed2555638c13244c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page