This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Authors: Rushy Panchal, Naphat Sanguansin, Adam Libresco, Jérémie Lumbroso.

Introduction

pywsse is an all-encompassing package to meet various needs for WSSE usage - both as an authentication backend (for various frameworks) and as a plug-and-play authentication mechanism for clients.

The motivation for this package came after dealing with various ambiguities in the WSSE protocol - some servers require specific digest algorithms and base64-encode different parts of the token. By utilizing a single library, you can be assured that there the token is generated and verified in the same way by both client and server.

Frameworks/Package Support

The following backend frameworks are currently supported:

In addition, the following client packages are supported:

Django REST Framework

To utilize the Django REST Framework plugin, install the Django plugin to settings.INSTALLED_APPS:

INSTALLED_APPS = (
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.sites',
  'django.contrib.staticfiles',
  'django.contrib.admin',

  'rest_framework',

  'wsse.server.django.wsse',
  )

In addition, add the authentication backend (wsse.server.drf.authentication.WSSEAuthentication) to settings.REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES']:

REST_FRAMEWORK = {
  'DEFAULT_AUTHENTICATION_CLASSES': (
    'rest_framework.authentication.SessionAuthentication',
    'wsse.server.drf.authentication.WSSEAuthentication'
    ),
  }

Alternatively, you can set it for a subset of your views.

Please refer to the Django REST Framework: Authentication Documentation for more information.

Finally, set the NONCE_STORE and NONCE_STORE_ARGS settings for the pywsse package:

import wsse
wsse.settings.NONCE_STORE = 'wsse.server.django.wsse.store.DjangoNonceStore'
wsse.settings.NONCE_STORE_ARGS = []
note:

Make sure to run the migrations after setting the nonce store. Particularly, you must run the migrations for the wsse app:

$ python manage.py migrate wsse

requests

The requests plugin is an authentication class that will automatically attach the appropriate header to the request.

To do so, import the wsse.client.requests.auth.WSSEAuth class and attach it to the request:

import requests
from wsse.client.requests.auth import WSSEAuth

response = requests.get('http://localhost:8000/api/',
  auth = WSSEAuth('username', 'password'))

The WSSEAuth class can be reused as it will generate a new token for each request:

import requests
from wsse.client.requests.auth import WSSEAuth

auth = WSSEAuth('username', 'password')

response = requests.get('http://localhost:8000/api/1/', auth = auth)
next_response = requests.get('http://localhost:8000/api/2/', auth = auth)

coreapi

The coreapi plugin is just a pluggable transport that automatically attaches the appropriate header before sending the request.

To make use of this transport, import the wsse.client.coreapi.transport.WSSEAuthenticatedHTTPTransport class and add it to your list of transports to coreapi.Client:

import coreapi
from wsse.client.coreapi.transport import WSSEAuthenticatedHTTPTransport

wsse_transport = WSSEAuthenticatedHTTPTransport('username', 'password')
client = coreapi.Client(transports = [wsse_transport])

schema = client.get('http://api.example.com')

You can also pass in any of the arguments or keyword arguments to coreapi.transports.HTTPTransport after the username and password.

Development

To run the development version of wsse, clone the repository and install the testing requirements in requirements.txt. Then, run the test suite using either tox or detox:

$ git clone git@github.com:PrincetonUniversity/pywsse.git
$ cd pywsse
$ virtualenv env
$ source env/bin/activate
$ pip install -r requirements.txt
$ detox

Note

detox is a parallel version of tox. It only runs with Python 2.6-2.7 (but it can and will run tests for Python 3.x versions).

Release History

Release History

0.1.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pywsse-0.1.4.tar.gz (22.7 kB) Copy SHA256 Checksum SHA256 Source Jan 4, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting