omniauth-zimbraadmin 0.0.3.2

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: 4954f3ba614bfcfa23e0840f749228e4775ca2d8
4
+ data.tar.gz: e1fda802c1f657bd6a841d6c3ded16fa2e0b04cb
5
+ SHA512:
6
+ metadata.gz: ae0eca38b02bd32737544b6007e038911e006c1d6ef72e4b3f4e6a398e98474f982d72847c0a61ed95e6960d87ecc24bfc7d1a8c1731175d92bc5c2ccb7a426a
7
+ data.tar.gz: b407b8b484a12110aef3c6b91f32b6766908734f47867789ec1ded1c05470566babc28ce824bf38a54469d0bdc93f5e7685809198d199af7a18e338db4fd01c8
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,68 @@
1
+ require 'omniauth'
2
+ require 'zimbra'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class ZimbraAdmin
7
+ include OmniAuth::Strategy
8
+
9
+ args [:endpoint]
10
+
11
+ option :title, "Zimbra Admin Auth"
12
+ option :debug, false
13
+
14
+ def request_phase
15
+ OmniAuth::Form.build(:title => options.title, :url => callback_path) do
16
+ text_field 'Email', 'email'
17
+ password_field 'Password', 'password'
18
+ button "Sign In"
19
+ end.to_response
20
+ end
21
+
22
+ def callback_phase
23
+ return fail!(:invalid_credentials) if !authentication_response
24
+ return fail!(:invalid_credentials) if authentication_response.code.to_i >= 400
25
+ super
26
+ end
27
+
28
+ protected
29
+
30
+ # by default we use static uri. If dynamic uri is required, override
31
+ # this method.
32
+ def endpoint
33
+ options.endpoint
34
+ end
35
+
36
+ def debug
37
+ options[:debug]
38
+ end
39
+
40
+ def username
41
+ request['email']
42
+ end
43
+
44
+ def password
45
+ request['password']
46
+ end
47
+
48
+ def authentication_response
49
+ unless @authentication_response
50
+ return unless username && password
51
+
52
+ Zimbra.debug = debug
53
+ Zimbra.admin_api_url = endpoint
54
+ begin
55
+ @authentication_response = Zimbra.reset_login(username, password)
56
+ rescue Exception => e
57
+ @authentication_response = false
58
+ end
59
+ end
60
+
61
+ @authentication_response
62
+ end
63
+
64
+ end
65
+ end
66
+ end
67
+
68
+ OmniAuth.config.add_camelization 'zimbraadmin', 'ZimbraAdmin'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module ZimbraAdmin
3
+ VERSION = "0.0.3.2"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require 'zimbra'
2
+ require 'omniauth-zimbraadmin/version'
3
+ require "omniauth/strategies/zimbra_admin"
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-zimbraadmin/version', __FILE__)
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-zimbraadmin"
8
+ spec.version = Omniauth::ZimbraAdmin::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-zimbraadmin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3.2
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-zimbraadmin.rb
102
+ - lib/omniauth-zimbraadmin/version.rb
103
+ - lib/omniauth/strategies/zimbra_admin.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: