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

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

Serving Software Downloads in 956 Categories, Downloaded 50.159.439 Times

repoze-oauth-plugin 0.1.1

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

repoze-oauth-plugin

Report Broken Link
Printer Friendly Version


Product Homepage
Download (46 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
Programming  -  extensions for linux 0.4
extensions is a simple plugin system inspired from setuptools entry points. It allows an application to define and/or use plugins. How to define a plugin A plugin can be any callable object . It has to be registered through...
20.48 KB  
Networking  -  BP Edit Group Slug 1.2
Adds extra tabs to Create and Edit methods to allow manual setting and editing of a BuddyPress Group slug.Uses the Group Extention API to make this as easy as installing and activating.Installation : 1. Upload bp-edit-group-slug.php to the...
10 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...
 
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  
Web Searching Tools  -  LinksSidebar 1.0.0
Perform group actions on multiple links like opening in tabs, copying link locations or testing to determine response times. Allows you to search/sort links and highlight their position on the webpage.
51.2 KB  
Utilities  -  DHCPDman 0.2
DHCPDman is a light weight, graphical configuration tool for a dhcpd server in Linux. Based on Red Hat's redhat-config-* tools, it aims to be simple and easy, yet flexible and powerful. You may define general, host, subnet, and group definitions...
40.96 KB  
Libraries  -  Embedix::ECD 0.09
Embedix::ECD is a Perl module with Embedix Component Descriptions as objects. SYNOPSIS instantiate from a file my $ecd = Embedix::ECD->newFromFile(busybox.ecd); my $other_ecd = Embedix::ECD->newFromFile(tinylogin.ecd); access nodes my...
40.96 KB  
Proxy Server Tools  -  rtspd 2.0
RTSP is the Real Time Streaming Protocol, which serves as a control protocol, and as a jumping off point for negotiating transports, such as RTP, multicast and unicast, and negotiating codecs off of servers in a file format independent way. RTSP...
81.92 KB  
Networking Tools  -  Flame 0.2.1
Just start Flame to see all the computers on the network that are advertising services. (If it can, it'll identify the user of each computer instead of giving you the machine's name.) Disclose the services available from each. You can even delve...
 
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
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  
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  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB