Skip to main content

A developer-mode plugin for repoze.who

Project description

who_dev

Testing Authenticataion for repoze.who v2 WSGI Applications

This plugin is intented for quickly configuring test users for development purposes. Its use is not recommended in production systems.

Installing

pip install who_dev

Installing the mainline development branch

The plugin is hosted in a git branch hosted at github.com. To get the latest source code, run:

git clone git@github.com:m-martinez/who_dev.git

Then run the command below:

pip install -e who_dev/

Configuring repoze.who in a INI file

You can configure your repoze.who based authentication via a *.ini file, and then load such settings in your application.

Say we have a file called who.ini with the following contents:

[general]
request_classifier = repoze.who.classifiers:default_request_classifier
challenge_decider = repoze.who.classifiers:default_challenge_decider

[identifiers]
plugins =
  auth_tkt

[authenticators]
plugins =
  auth_tkt
  dev_auth

[challengers]
plugins =
    form;browser

[mdproviders]
plugins =
  dev_properties
  dev_groups

[plugin:form]
use = repoze.who.plugins.form:make_plugin
rememberer_name = auth_tkt

[plugin:auth_tkt]
use = repoze.who.plugins.auth_tkt:make_plugin
secret = s3kr1t

[plugin:dev_auth]
use = who_dev:JSONAuthenticatorPlugin
data = {
  "someuser":  {
    "password": "abc123",
    "properties": {
      "first_name": "Some",
      "last_name": "User",
      "email": "someuser@localhost"
    },
    "groups": ["members", "editors"]
  }
}

[plugin:dev_properties]
use = who_dev:JSONPropertiesPlugin
source_key = properties

[plugin:dev_groups]
use = who_dev:JSONPropertiesPlugin
source_key = groups

Framework-specific documentation

You may want to check the following framework-specific documents to learn tips on how to implement repoze.who in the framework you are using:

Configuration

JSONAuthenticatorPlugin

This plugin uses a JSON object as a database, where each key in the object is the userid and the value is another object with specific details about the user, which can then be used along ith JSONPropertiesPlugin to retrieve specific details about the user.

Each record for a user must at a minimum contain a password entry so that the user can authenticate, for example:

data={
  "someuser": {"password": "abc123"},
  "otheruser": {"password": "xyz789"}
}

Setting

Default

Description

data

Required A JSON object contaiing records for each test userid.

JSONPropertiesPlugin

This plugin uses the specific key in the authenticator data to lookup specific details about a user.

Setting

Default

Description

source_key

Required Sets the remote user data to the value located at source_key for the currently authenticated userid.

Changelog

0.0.2 (2016-06-22)

  • Converted to actual module so setup.py packages correctly

0.0.1 (2015-10-19)

  • The initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

who_dev-0.0.2.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file who_dev-0.0.2.tar.gz.

File metadata

  • Download URL: who_dev-0.0.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for who_dev-0.0.2.tar.gz
Algorithm Hash digest
SHA256 25f9ebcad1cf272cefdfeeb745a234fe38868bde4c9204ad57401e41eb99265d
MD5 8250c119589dc33b91e019b6e010bc25
BLAKE2b-256 c15f57791589b94364e740d0928f7322f93170458e9a8469b13f81345bad3593

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page