Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates in readme and following specs nomenclature #1

Merged
merged 2 commits into from
Jan 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 18 additions & 72 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
.. |gae| replace:: Google App Engine
.. _gae: https://developers.google.com/appengine/

.. |webapp2| replace:: Webapp2
.. _webapp2: http://webapp-improved.appspot.com/

.. |oauth2| replace:: OAuth 2.0
.. _oauth2: http://oauth.net/2/

.. |oauth1| replace:: OAuth 1.0a
.. _oauth1: http://oauth.net/core/1.0a/

.. |openid| replace:: OpenID
.. _openid: http://openid.net/

.. |pyopenid| replace:: python-openid
.. _pyopenid: http://pypi.python.org/pypi/python-openid/

==========
Authomatic
==========

.. image:: https://travis-ci.org/peterhudec/authomatic.svg?branch=master
:target: https://travis-ci.org/peterhudec/authomatic

**Authomatic**
Forked from **Authomatic** which
is a **framework agnostic** library
for **Python** web applications
with a **minimalistic** but **powerful** interface
Expand All @@ -36,58 +15,25 @@ For more info visit the project page at http://peterhudec.github.io/authomatic.
Features
========

* Loosely coupled.
* Tiny but powerful interface.
* The |pyopenid|_ library is the only **optional** dependency.
* **Framework agnostic** thanks to adapters.
Out of the box support for **Django**, **Flask**, **Pyramid** and **Webapp2**.
* Ready to accommodate future authorization/authentication protocols.
* Makes provider API callls a breeze.
* Asynchronous requests.
* JavaScript library as a bonus.
* Out of the box support for:

* |oauth1|_ providers: **Bitbucket**, **Flickr**, **Meetup**, **Plurk**,
**Twitter**, **Tumblr**, **UbuntuOne**, **Vimeo**, **Xero**, **Xing** and **Yahoo**.
* |oauth2|_ providers: **Amazon**, **Behance**, **Bitly**, **Cosm**,
**DeviantART**, **Eventbrite**, **Facebook**, **Foursquare**,
**GitHub**, **Google**, **LinkedIn**, **PayPal**, **Reddit**,
**Viadeo**, **VK**, **WindowsLive**, **Yammer** and **Yandex**.
* |pyopenid|_ and |gae|_ based |openid|_.

License
=======

The package is licensed under
`MIT license <http://en.wikipedia.org/wiki/MIT_License>`__.

Requirements
============

Requires **Python 2.6** and newer. **Python 3.x** support added in
**Authomatic 0.0.11** thanks to
`Emmanuel Leblond <https://github.com/touilleMan>`__.

Live Demo
=========

There is a |gae| based live demo app running at
http://authomatic-example.appspot.com which makes use of most of the features.

Contribute
==========

.. image:: http://badge.waffle.io/peterhudec/authomatic.png
:target: http://waffle.io/peterhudec/authomatic
:alt: Stories in Ready

Contributions of any kind are very welcome.
If you want to contribute, please read the
`Development Guide <http://peterhudec.github.io/authomatic/development.html>`__
first. The project is hosted on
`GitHub <https://github.com/peterhudec/authomatic>`__.
* Added new client credentials grant type authorization for users

Usage
=====

Read the exhaustive documentation at http://peterhudec.github.io/authomatic.
Just a small change in configuring your providers, just mention the grant type
for your authorization flow in the provider class like this

for Client credential grant type
```
grant_type = AuthorizationProvider.CLIENT_CREDENTIALS_GRANT_TYPE
```

for authorization code grant type
```
grant_type = AuthorizationProvider.AUTHORIZATION_CODE_GRANT_TYPE
```

The default grant_type is also AUTHORIZATION_CODE_GRANT_TYPE so if you
don't mention the grant type it will automatically assume it to be
AUTHORIZATION_CODE_GRANT_TYPE.
2 changes: 1 addition & 1 deletion authomatic/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ class AuthorizationProvider(BaseProvider):
PROTECTED_RESOURCE_REQUEST_TYPE = 4
REFRESH_TOKEN_REQUEST_TYPE = 5
AUTHORIZATION_CODE_GRANT_TYPE = 6
CLIENT_CREDENTIAL_GRANT_TYPE = 7
CLIENT_CREDENTIALS_GRANT_TYPE = 7

BEARER = 'Bearer'

Expand Down
8 changes: 4 additions & 4 deletions authomatic/providers/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def create_request_elements(cls, request_type, credentials, url, method='GET', p
# User authorization request.
# TODO: Raise error for specific message for each missing argument.
if consumer_key and redirect_uri and (csrf or not cls.supports_csrf_protection):
if cls.grant_type == cls.CLIENT_CREDENTIAL_GRANT_TYPE:
if cls.grant_type == cls.CLIENT_CREDENTIALS_GRANT_TYPE:
pass
elif cls.grant_type == cls.AUTHORIZATION_CODE_GRANT_TYPE:
params['client_id'] = consumer_key
Expand All @@ -152,7 +152,7 @@ def create_request_elements(cls, request_type, credentials, url, method='GET', p
params['redirect_uri'] = redirect_uri
params['grant_type'] = 'authorization_code'

elif cls.grant_type == cls.CLIENT_CREDENTIAL_GRANT_TYPE:
elif cls.grant_type == cls.CLIENT_CREDENTIALS_GRANT_TYPE:
params['client_id'] = consumer_key
params['client_secret'] = consumer_secret
params['redirect_uri'] = redirect_uri
Expand Down Expand Up @@ -302,7 +302,7 @@ def login(self):
state = self.params.get('state')


if authorization_code or not self.user_authorization_url or self.grant_type == authprovider.CLIENT_CREDENTIAL_GRANT_TYPE:
if authorization_code or not self.user_authorization_url or self.grant_type == authprovider.CLIENT_CREDENTIALS_GRANT_TYPE:

if authorization_code:
#===================================================================
Expand All @@ -325,7 +325,7 @@ def login(self):
else:
self._log(logging.WARN, u'Skipping CSRF validation!')

elif not self.user_authorization_url or self.grant_type == authprovider.CLIENT_CREDENTIAL_GRANT_TYPE:
elif not self.user_authorization_url or self.grant_type == authprovider.CLIENT_CREDENTIALS_GRANT_TYPE:
#===================================================================
# Phase 1 without user authorization redirect.
#===================================================================
Expand Down