Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.614.704 Times

repoze-oauth-plugin 0.1.1

Company: Linas Juskevicius
Date Added: September 27, 2013  |  Visits: 212

repoze-oauth-plugin

Report Broken Link
Printer Friendly Version


Product Homepage
Download (16 downloads)



repoze-oauth-plugin is a repoze.who and repoze.what plugin implementing the server side of the OAuth 1.0 protocol. Currently it supports only 2-legged flow where the client is at the same time a resource owner. This happens when a client application has access to the resources on the server on behalf of itself and does not need a user (human) permission for the access.<br /><br />You can read more about OAuth at hueniverse (2-legged flow).<br /><br />Installation<br /><br />easy_install:<br /><br />$ < env >/bin/easy_install repoze-oauth-plugin<br /><br />pip:<br /><br />$ < env >/bin/pip install repoze-oauth-plugin<br /><br />OAuthPlugin Usage<br /><br />You can create the plugin with:<br /><br />>>> from repoze.who.plugins.oauth import OAuthPlugin<br />>>> oauth_plugin = OAuthPlugin(DBSession=Session,<br />... Manager=MyManager,<br />... realm='my-realm')<br /><br />where:<br /><br /> * Session is an SQLAlchemy Session bound to a valid engine. If you are configuring the plugin through the PasteDeploy configuration file this can be an entry point, e.g. myproject.model.meta:Session.<br /> * Manager (optional) is a class that is responsible for client management in the database. Default - repoze.who.plugins.oauth:DefaultManager. The Manager has to take the Session as an initialization parameter and provide a get_consumer_by_key(key) instance method. Can be provided as an entry point too.<br /> * realm (optional) - a realm identifying the protection space.<br /><br />The repoze.who plugin in repoze-oauth-plugin acts as an Identifier, Authenticator and Challenger. Therefore to get OAuth support you need to give it as identifier, authenticator and challenger to the repoze.who middleware, similar to this (here we create it using repoze.what provided helper):<br /><br />>>> oauth_plugin = OAuthPlugin(Session, realm='MyRealm')<br />>>> from repoze.what.middleware import setup_auth<br />>>> app = PluggableAuthenticationMiddleware(my_app,<br />... group_adapters=my_group_adapters,<br />... permission_adapters=my_permission_adapters,<br />... identifiers=[('oauth', plugin)],<br />... authenticators=[('oauth', plugin)],<br />... challengers=[('oauth', plugin)],<br />... **other_kwargs)<br /><br />However, usually you would use some higher level middleware maker. Let's take repoze.what-quickstart as an example:<br /><br />>>> oauth_plugin = OAuthPlugin(Session, realm='MyRealm')<br />>>> from repoze.what.plugins.quickstart import setup_sql_auth<br />>>> app = setup_sql_auth(app, User, Group, Permission, Session,<br />... identifiers=[('oauth', oauth_plugin)],<br />... authenticators=[('oauth', oauth_plugin)],<br />... challengers=[('oauth', oauth_plugin)])<br /><br />repoze-oauth-plugin uses oauth2 for OAuth specific functionality and plays well with restkit.<br /><br />Predicate Usage<br /><br />If you have set the OAuthPlugin with setup_sql_auth (or any other way that includes repoze.what support) you can use OAuth specific predicates provided by repoze-oauth-plugin.<br /><br />is_consumer([consumer_key=None]) is a predicate that checks whether the current user is a consumer acting on behalf of itself (2-legged flow):<br /><br />>>> from repoze.what.plugins.oauth import is_consumer<br />>>> p = is_consumer()<br />>>> p.check_authorization(environ)<br />Traceback (most recent call last):<br />...<br />repoze.what.predicates.NotAuthorizedError: The current user must be a consumer<br /><br />Ask for a consumer with a particular key:<br /><br />>>> p = is_consumer('my-app')<br /><br />not_oauth() is a predicate that denies access through OAuth. All other methods are allowed (even anonymous!):<br /><br />>>> from repoze.what.plugins.oauth import not_oauth<br />>>> p = not_oauth()<br />>>> p.check_authorization(environ_with_oauth)<br />Traceback (most recent call last):<br />...<br />repoze.what.predicates.NotAuthorizedError: Access through OAuth forbidden<br />>>> p.check_authorization({}) # Empty environ, no user - ok!<br /><br />Pylons setup<br /><br />The following is an example setup for a Pylons application. Let's assume it is called ExampleApp. We'll use repoze.what-quickstart and repoze.what-pylons:<br /><br />$ < env >/bin/pip install repoze.what-quickstart repoze.what-pylons<br /><br />First, in your exampleapp/config/middleware.py file define imports:<br /><br />from repoze.what.plugins.quickstart import setup_sql_auth<br />from repoze.who.plugins.oauth import OAuthPlugin<br /><br />from exampleapp.model import User, Group, Permission<br />from exampleapp.model.meta import Session<br /><br />then just below:<br /><br /># The Pylons WSGI app<br />app = PylonsApp(config=config)<br /><br />create the repoze-oauth-plugin and provide a realm and SQLAlchemy session:<br /><br />oauth_plugin = OAuthPlugin(realm='exampleapp', DBSession=Session)<br />app = setup_sql_auth(app, User, Group, Permission, Session,<br /> identifiers=[('oauth', oauth_plugin)],<br /> authenticators=[('oauth', oauth_plugin)],<br /> challengers=[('oauth', oauth_plugin)])<br /><br />According to the OAuth specification in case of 401 Unauthorized the server has to return a WWW-Authenticate: OAuth realm="..." header. Pylons StatusCodeRedirect middleware replaces the 401 response with its own custom 401 response discarding even the headers set by the downstream application. In order to avoid this StatusCodeRedirect can be configured to not intercept the 401 response. In exampleapp/config/middleware.py replace:<br /><br /># Display error documents for 401, 403, 404 status codes (and<br /># 500 when debug is disabled)<br />if asbool(config['debug']):<br /> app = StatusCodeRedirect(app)<br />else:<br /> app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])<br /><br />with:<br /><br /># Display error documents for 400, 403, 404 status codes (and<br /># 500 when debug is disabled)<br />if asbool(config['debug']):<br /> app = StatusCodeRedirect(app, [400, 403, 404])<br />else:<br /> app = StatusCodeRedirect(app, [400, 403, 404, 500])<br /><br />With the above setup you will have the OAuth consumer information in the environment whenever successful authentication happens.<br /><br />In order to be sure that only valid consumers can access your controllers and actions you have to protect them with repoze.what-pylons predicates:<br /><br /># exampleapp/controllers/cars.py<br />...<br />from repoze.what.plugins.pylonshq import ActionProtector<br />from repoze.what.plugins.oauth import is_consumer, not_oauth<br /><br />class CarsController(BaseController):<br /><br /> @ActionProtector(is_consumer)<br /> def index(self):<br /> return 'Hello, Consumer'<br /><br /> @ActionProtector(not_oauth)<br /> def public(self):<br /> return 'Not for consumer'<br /><br /><br /># exampleapp/controllers/trucks.py<br />...<br />from repoze.what.plugins.pylonshq import ControllerProtector<br />from repoze.what.plugins.oauth import is_consumer<br /><br />class TrucksController(BaseController):<br /><br /> def index(self):<br /> return 'Hello, all consumers'<br /><br />TrucksController = ControllerProtector(is_consumer)(TrucksController)<br /><br />Now these actions can be accessed using restkit:<br /><br />>>> from restkit import OAuthFilter, request, oauth2<br />>>> consumer = oauth2.Consumer(key='the-consumer',<br />... secret='the-consumer-secret')<br />>>> auth = OAuthFilter(('*', consumer))<br />>>> resp = request('http://localhost:5000/cars/index', filters=[auth])<br />>>> print resp.body<br /><br />#md5=a15aafbec78f941c73c38528aef87c21

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Authenticators Oauth Challengers Oauth Consumer Group Identifiers Oauth Import Oauth Oauth Plugin Plugin Pylons Re Repoze Repozeoauthplugin Repozewhat Repozewhatpluginsoauth Repozewhatquickstart Repozewho Response Return Server Session
Users rating: 0/10

License: Freeware Size: 10.24 KB
USER REVIEWS
More Reviews or Write Review


REPOZE-OAUTH-PLUGIN RELATED
Modules  -  Feeds OAuth 6.x-1.0-beta1
Feeds OAuth provides a new Feeds fetcher plugin that performs OAuth authorization before requesting a feed.Installation * Install PECL::oauth Usage * Obtain standard OAuth information from host: consumer key, consumer secret, request token URL,...
10 KB  
Modules  -  Services OAuth 6.x-1.0-beta6
It requires the OAuth Common module, which depends on Input Stream.Installation:Unpack in your modules folder (usually '/sites/all/modules/')Enable under Administer > Site Building > Modules
10 KB  
Network & Internet  -  django-oauth-twitter 1.11
A Django application that lets you associate Twitter accounts with your User accounts. Clone this repository (size: 53.7 KB): HTTPS / SSH $ hg clone http://bitbucket.org/akoha/django-oauth-twitter/ Here are some key features...
10.24 KB  
Modules  -  LinkedIn Integration 6.x-1.x-de
This module provides integration with the LinkedIn API. At the moment it supports the following features: * Per-user OAuth authentication between LinkedIn and Drupal * Post LinkedIn status from node edit form (like the Twitter module) *...
30.72 KB  
Utilities  -  Sendtools 0.1.1
Sendtools is a collections of classes for efficiently consuming iterators into one or more data structures. Sendtools compliments the itertools module and other the excellent facilities Python offers for iteration. Sendtools is useful...
10.24 KB  
Security Tools  -  Forefront Endpoint Protection Tools 2.1.1116.0
These tools make it easier for Forefront Endpoint Protection 2010 customers to use Group Policy for centralized management, provide optimized settings for various server roles, and diagnose and troubleshoot support issues. FEP Group Policy Tools...
 
Networking  -  User Access Manager 1.2.1
With the "User Access Manager"-plugin you can manage the access to your posts, pages and files. You only create a user group, put registered users to this and set up the rights for this group. From now on the post/page is only accessible and...
358.4 KB  
Networking  -  Wikinvest Stock Charts 1.01
Display stock charts on your blog * Easy to Use - Enter stock tickers or let the plugin suggest identified companies * Custom Date Ranges - Display chart prices for several years or several days * Custom Sizes - Choose from standard sizes or...
10 KB  
Networking  -  Wildflowerizer 1.1
Wildflowerizer is a sidebar widget that randomly displays a photo that's been recently added to the Wildflower Field Guide, North America group at Flickr.Installation : 1. Install the plugin through the 'Plugins' menu in WordPress. If installing...
10 KB  
Modules  -  Node Import Update 6.x-0.2
This module is intended to simply add update functionality to the excellent Node Import module. The maintainer of Node Import has expressed a desire for that module to remain focused on importing nodes. So this module's intent is to focus...
10 KB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB