Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atmos/warden-googleapps
warden strategy for google apps federated login
https://github.com/atmos/warden-googleapps
Last synced: 2 months ago
JSON representation
warden strategy for google apps federated login
- Host: GitHub
- URL: https://github.com/atmos/warden-googleapps
- Owner: atmos
- License: mit
- Created: 2010-01-03T03:53:57.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2013-06-05T19:04:21.000Z (over 11 years ago)
- Last Synced: 2024-10-14T13:04:09.411Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 263 KB
- Stars: 25
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
warden-googleapps
=================A Warden middleware for google apps. It needs a little work but definitely authenticates you just fine in Rack apps.
Example
=======
Gemfile
-------
source :gemcuttergem 'haml', '~>2.2.0'
gem 'warden-googleapps', '=0.0.3'group :development do
gem 'shotgun'
endapp.rb
------
```ruby
module DirectoryAdmin
class App < Sinatra::Default
disable :show_errors
disable :show_exceptionsuse Warden::Manager do |manager|
manager.default_strategies :google_apps
manager.failure_app = BadAuthenticationmanager[:google_apps_domain] = 'example.org'
# manager[:google_apps_endpoint] = 'http://www.google.com/accounts/o8/id' # this is gmail
# manager[:google_apps_redirect_url] = 'http://example.org/verify_url' # endpoint where google apps redirects to after successful authentication
endhelpers do
def ensure_authenticated
unless env['warden'].authenticate!
throw(:warden)
end
enddef user
env['warden'].user
end
endget '/' do
ensure_authenticated
haml "%h2= 'Hello There, #{user.full_name}!'"
endget '/logout' do
env['warden'].logout
haml "%h2= 'Peace!'"
end
endclass BadAuthentication < Sinatra::Default
get '/unauthenticated' do
status 403
haml "%h3= 'Unable to authenticate, sorry bud.'"
end
end
end
```
Enabling on GMail
==================
It should just work, even for localhost.Also checkout [sinatra-auth-gmail](http://github.com/atmos/sinatra-auth-gmail).
Enabling on Google Apps for Domains
===================================
Be sure you have Federated Login using OpenID enabled under your Advanced Settings Tab![Your Google Apps Admin Dashboard](http://img.skitch.com/20100103-cdjtbyyw2xsbwya92r6gcd47hr.jpg "Check the box to enable")
Developing
==========
% gem install bundler
% bundle install
% bundle exec rake repackage