[Python-modules-commits] [python-social-auth] 300/322: added generic resource setting added license text added documentation file

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:13:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.10
in repository python-social-auth.

commit 0a1c8a7ea5da636f5619962e73bd9b9f433f54de
Author: vinhub <vin.bhalerao at gmail.com>
Date:   Mon May 11 14:52:58 2015 -0700

    added generic resource setting
    added license text
    added documentation file
---
 docs/backends/azuread.rst  | 19 +++++++++++++++++++
 license.txt                | 23 +++++++++++++++++++++++
 social/backends/azuread.py | 15 ++++++++++++++-
 3 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/docs/backends/azuread.rst b/docs/backends/azuread.rst
new file mode 100644
index 0000000..8ec2457
--- /dev/null
+++ b/docs/backends/azuread.rst
@@ -0,0 +1,19 @@
+Microsoft Azure Active Directory
+======
+
+To enable OAuth2 support:
+
+- Fill in ``Client ID`` and ``Client Secret`` settings. These values can be obtained
+  easily as described in `Azure AD Application Registration`_ doc::
+
+      SOCIAL_AUTH_AZUREAD_OAUTH2_KEY = ''
+      SOCIAL_AUTH_AZUREAD_OAUTH2_SECRET = ''
+
+- Also it's possible to define extra permissions with::
+
+      SOCIAL_AUTH_AZUREAD_OAUTH2_RESOURCE = ''
+
+      This is the resource you would like to access after authentication succeeds. 
+      Some of the possible values are: ``https://graph.windows.net`` or ``https://<your Sharepoint site name>-my.sharepoint.com``.
+
+.. _Azure AD Application Registration: https://msdn.microsoft.com/en-us/library/azure/dn132599.aspx
diff --git a/license.txt b/license.txt
new file mode 100644
index 0000000..d921824
--- /dev/null
+++ b/license.txt
@@ -0,0 +1,23 @@
+Copyright (c) 2015 Microsoft Open Technologies, Inc.
+
+All rights reserved. 
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/social/backends/azuread.py b/social/backends/azuread.py
index b716ae3..769a0f6 100644
--- a/social/backends/azuread.py
+++ b/social/backends/azuread.py
@@ -57,9 +57,22 @@ class AzureADOAuth2(BaseOAuth2):
         
         return decoded_id_token
 
+    def auth_extra_arguments(self):
+        """Return extra arguments needed on auth process. The defaults can be
+        overriden by GET parameters."""
+        extra_arguments = {}
+        resource = self.setting('RESOURCE')
+        
+        if resource:
+            extra_arguments = {
+                'resource': resource
+            }
+        
+        return extra_arguments
+
     def extra_data(self, user, uid, response, details=None):
         """Return access_token and extra defined names to store in
         extra_data field"""
         data = super(BaseOAuth2, self).extra_data(user, uid, response, details)
+        data['resource'] = self.setting('RESOURCE')
         return data
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git



More information about the Python-modules-commits mailing list