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

Updated the project #9

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Explicitly declare text files we want to always be normalized and converted to native line endings on checkout.
*.md text
*.txt text

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
27 changes: 26 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
*.gem
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore config files & directories.
/.bundle
/.idea
.project

# Ignore unnecessary Ruby & Rails components.
/db
/doc
/features
/log
/spec
/test
/tests
/tmp
/vendor/bundle

# Ignore OS cache files & directories.
_MACOSX
*.DS_Store
Thumbs.db
15 changes: 1 addition & 14 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
source "http://rubygems.org"
source 'https://rubygems.org'

# Specify your gem's dependencies in omniauth-google-apps.gemspec
gemspec

group :development, :test do
gem 'guard'
gem 'guard-rspec'
gem 'guard-bundler'
gem 'rb-fsevent'
gem 'growl'
end

group :example do
gem 'sinatra'
gem 'thin'
end
88 changes: 0 additions & 88 deletions Gemfile.lock

This file was deleted.

10 changes: 0 additions & 10 deletions Guardfile

This file was deleted.

22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2011-2013 Dingding Ye

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.
48 changes: 29 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# OmniAuth Google Apps

This is the OmniAuth strategy for authenticating to Google Apps.

## Basic Usage

use OmniAuth::Builder do
# domain is optional attribute
provider :google_apps #, domain: 'intridea.com'
end

## License

Copyright (c) 2011 Dingding Ye.

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.
This is the OmniAuth strategy for authenticating to Google Apps.

## Installation
Stick this into your application's Gemfile:
```ruby
gem 'omniauth-google-apps'
```
or this into your project's gemspec if your making a gem:
```ruby
# The "spec" variable depends on what Gem::Specification.new is set w/
spec.add_dependency 'omniauth-google-apps'
```
and then execute:
```bash
bundle --path vendor/bundle
```

## Usage
```ruby
# The domain attribute is optional
use OmniAuth::Builder {
provider :google_apps #, domain: 'intridea.com'
}
```

## Contributing
1. Fork it
2. Commit your changes (`git commit -m "my awesome change!"`)
3. Create a new pull request
13 changes: 1 addition & 12 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'rspec/core/rake_task'

desc 'Default: run specs.'
task :default => :spec

desc "Run specs"
RSpec::Core::RakeTask.new

desc 'Run specs'
task :default => :spec
require 'bundler/gem_tasks'
24 changes: 0 additions & 24 deletions examples/test.rb

This file was deleted.

50 changes: 48 additions & 2 deletions lib/omniauth-google-apps.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
require "omniauth-google-apps/version"
require "omniauth/strategies/google_apps"
require 'openid/consumer'
require 'gapps_openid'

module OpenID
# Because gapps_openid changes the discovery order (looking first for Google Apps, then anything else), we need to patch it to make it play nicely with others.
def self.discover(uri)
raise OpenID::DiscoveryFailure.new('No URL Provided', 422) if uri.nil?

begin
discovered = self.default_discover uri

if discovered.last.empty?
info = discover_google_apps uri
return info if info
end

return discovered
rescue OpenID::DiscoveryFailure => e
info = discover_google_apps uri
if info.nil?
raise e
else
return info
end
end
end

def self.discover_google_apps(uri)
GoogleDiscovery.new.perform_discovery uri
end
end

module OmniAuth
module Strategies
class GoogleApps < OmniAuth::Strategies::OpenID
option :name, 'google_apps'
option :domain, nil

def get_identifier
OmniAuth::Form.new(title: 'Google Apps Authentication').label_field('Google Apps Domain', 'domain').input_field('url', 'domain').to_response
end

def identifier
options[:domain] || request['domain']
end
end
end
end
5 changes: 0 additions & 5 deletions lib/omniauth-google-apps/version.rb

This file was deleted.

22 changes: 0 additions & 22 deletions lib/omniauth/strategies/google_apps.rb

This file was deleted.

36 changes: 0 additions & 36 deletions lib/openid/gapps.rb

This file was deleted.

Loading