omniauth-zimbra 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 72ee23f809748d9a39f74cd5ea2fd0ec35ebdbae
4
+ data.tar.gz: 9385b66738106d98950f1d04ed0eed3ad06165c5
5
+ SHA512:
6
+ metadata.gz: 71d033320326ceefe34cfc4c1ba027cda4d6d499e350c865989ef677f7a8565f05a03e1276f9ade52e9c6a6e2c77a04c368044694ca824d6691c5847cca044b1
7
+ data.tar.gz: d2dc6494ca243ec31fc18858191b5b97c53a89cb561f28a865d1cd658ca7a351829fa5d15891e83067cb13b5dcdf66e47ee04752f3c7cbe8b7cc98d5e4345b2f
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-zimbra.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Patricio Bruna
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Omniauth::Zimbra
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'omniauth-zimbra'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install omniauth-zimbra
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/omniauth-zimbra/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |task|
5
+ task.libs << %w(test lib)
6
+ task.pattern = 'test/test_*.rb'
7
+ end
8
+
9
+ task :default => :test
@@ -0,0 +1,60 @@
1
+ require 'omniauth'
2
+ require 'net/zimbra'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Zimbra
7
+ include OmniAuth::Strategy
8
+
9
+ args [:endpoint]
10
+
11
+ option :title, "Zimbra Admin Auth"
12
+
13
+ def request_phase
14
+ OmniAuth::Form.build(:title => options.title, :url => callback_path) do
15
+ text_field 'Email', 'email'
16
+ password_field 'Password', 'password'
17
+ button "Sign In"
18
+ end.to_response
19
+ end
20
+
21
+ def callback_phase
22
+ return fail!(:invalid_credentials) if !authentication_response
23
+ return fail!(:invalid_credentials) if authentication_response.code.to_i >= 400
24
+ super
25
+ end
26
+
27
+ protected
28
+
29
+ # by default we use static uri. If dynamic uri is required, override
30
+ # this method.
31
+ def endpoint
32
+ options.endpoint
33
+ end
34
+
35
+ def username
36
+ request['email']
37
+ end
38
+
39
+ def password
40
+ request['password']
41
+ end
42
+
43
+ def authentication_response
44
+ unless @authentication_response
45
+ return unless username && password
46
+
47
+ Zimbra.admin_api_url = endpoint
48
+ begin
49
+ @authentication_response = Zimbra.reset_login(username, password)
50
+ rescue Exception => e
51
+ @authentication_response = false
52
+ end
53
+ end
54
+
55
+ @authentication_response
56
+ end
57
+
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Zimbra
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require 'zimbra'
2
+ require 'omniauth-zimbra/version'
3
+ require "omniauth/strategies/zimbra"
4
+
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require File.expand_path('../lib/omniauth-zimbra/version', __FILE__)
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-zimbra"
8
+ spec.version = Omniauth::Zimbra::VERSION
9
+ spec.authors = ["Patricio Bruna"]
10
+ spec.email = ["pbruna@gmail.com"]
11
+ spec.summary = "Zimbra authentication strategy for OmniAuth"
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://github.com/pbruna/omniauth-zimbra"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'omniauth', '~> 1.0'
22
+ spec.add_dependency 'zimbra', '~> 0.0', '>= 0.0.5'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+ spec.add_development_dependency "rake", "~> 10.4"
26
+ spec.add_development_dependency "minitest-reporters", "~> 1.0"
27
+ end
@@ -0,0 +1,7 @@
1
+ require 'omniauth'
2
+ require "omniauth-zimbra"
3
+
4
+ require 'minitest/autorun'
5
+ require 'minitest/reporters' # requires the gem
6
+
7
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new # spec-like progress
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-zimbra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Patricio Bruna
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: zimbra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.0.5
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.0.5
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.6'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.6'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '10.4'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '10.4'
75
+ - !ruby/object:Gem::Dependency
76
+ name: minitest-reporters
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.0'
89
+ description: Zimbra authentication strategy for OmniAuth
90
+ email:
91
+ - pbruna@gmail.com
92
+ executables: []
93
+ extensions: []
94
+ extra_rdoc_files: []
95
+ files:
96
+ - ".gitignore"
97
+ - Gemfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - lib/omniauth-zimbra.rb
102
+ - lib/omniauth-zimbra/version.rb
103
+ - lib/omniauth/strategies/zimbra.rb
104
+ - omniauth-zimbra.gemspec
105
+ - test/test_helper.rb
106
+ homepage: https://github.com/pbruna/omniauth-zimbra
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.2.2
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Zimbra authentication strategy for OmniAuth
130
+ test_files:
131
+ - test/test_helper.rb
132
+ has_rdoc: