Skip to content

Commit

Permalink
first stab at seperating googleauth from hudoratools
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximillian Dornseif committed Jan 2, 2010
1 parent 850ae19 commit 4cf0249
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 404 deletions.
6 changes: 1 addition & 5 deletions CHANGES
@@ -1,6 +1,2 @@
0.26p1 - bugs in forms.py fixed
1.0 - stand alone package
0.26 - comes with the googleauth suite
0.25 - added artnr2name filter
0.24 - Added forms.py, a generic approach for hudora specific address validation
0.23 - Added sites.py, a framework for internal and public URLs

14 changes: 5 additions & 9 deletions Makefile
Expand Up @@ -3,31 +3,27 @@ PATH := ./testenv/bin:$(PATH)
default: dependencies check test statistics

check:
find hudoratools -name '*.py' | xargs /usr/local/hudorakit/bin/hd_pep8
/usr/local/hudorakit/bin/hd_pylint -f parseable hudoratools | tee pylint.out
find googleappsauth -name '*.py' | xargs /usr/local/hudorakit/bin/hd_pep8
/usr/local/hudorakit/bin/hd_pylint -f parseable googleappsauth | tee .pylint.out

install: build
sudo python setup.py install

test: dependencies
DJANGO_SETTINGS_MODULE=settings PYTHONPATH=. python hudoratools/templatetags/hudoratools.py
DJANGO_SETTINGS_MODULE=settings PYTHONPATH=. python hudoratools/forms.py

dependencies:
virtualenv testenv
pip -q install -E testenv -r requirements.txt

statistics:
sloccount --wide --details hudoratools | grep -E '^[0-9]' > sloccount.sc
sloccount --wide --details googleappsauth | grep -E '^[0-9]' > .sloccount.sc

build:
python setup.py build sdist bdist_egg

upload: build
rsync dist/* root@cybernetics.hudora.biz:/usr/local/www/apache22/data/nonpublic/eggs/
python setup.py sdist upload

clean:
rm -Rf testenv build dist html test.db hudoratools.egg-info pylint.out sloccount.sc pip-log.txt
rm -Rf testenv build dist html test.db .pylint.out .sloccount.sc pip-log.txt
find . -name '*.pyc' -or -name '*.pyo' -delete

.PHONY: test build clean install upload check
48 changes: 48 additions & 0 deletions README.markdown
@@ -0,0 +1,48 @@
# Authentication agains Google Apps Domains for Django

*googleappsauth* allows you to authenticate your [Django][1] users against an Google Apps[2] domain.
This means you basically get a single sign-on solution, provided that all users of your django application
also have Accounts in Google Apps for your Domain.

[1]: http://www.djangoproject.com/
[2]: http://www.google.com/apps/

## Usage

To use googleappsauth, configuration in `settings.py` should look like this:

GOOGLE_APPS_DOMAIN = 'example.com'
GOOGLE_APPS_CONSUMER_KEY = 'example.com'
GOOGLE_APPS_CONSUMER_SECRET = '*sekret*'
GOOGLE_OPENID_ENDPOINT = 'https://www.google.com/a/%s/o8/ud?be=o8' % GOOGLE_APPS_DOMAIN
GOOGLE_API_SCOPE = 'http://www.google.com/m8/feeds/+http://docs.google.com/feeds/+http://spreadsheets.google.com/feeds/'
# domain where your application is running
GOOGLE_OPENID_REALM = 'http://*.hudora.biz/'

You also have to tell googleappsauth where various views life:

LOGIN_URL = '/login'
LOGIN_REDIRECT_URL = '/admin'
LOGOUT_URL = '/logout'

To activate googleappsauth, set the appropriate Authentication backend and include a callback view.

settings.py:
AUTHENTICATION_BACKENDS = ('googleappsauth.backends.GoogleAuthBackend',)

urls.py:
(r'^callback_googleappsauth/', 'googleappsauth.views.callback'),


Using a special middleware which is included int he package, you can block access to a compete site.

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'googleappsauth.middleware.GoogleAuthMiddleware',
)

In addition you can set `AUTH_PROTECTED_AREAS` to authenticate only access to certain parts of a site, e.g.

AUTH_PROTECTED_AREAS = '/admin'
4 changes: 0 additions & 4 deletions README.txt

This file was deleted.

276 changes: 0 additions & 276 deletions ez_setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions requirements.txt
@@ -1,4 +1,2 @@
Django==1.0.2-final
-f https://cybernetics.hudora.biz/nonpublic/eggs/
cs
huTools>=0.39p3
setuptools
Django>-1.0.2-final

0 comments on commit 4cf0249

Please sign in to comment.