omniauth-smailex 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +39 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/example/server.rb +40 -0
- data/lib/omniauth-smailex.rb +1 -0
- data/lib/omniauth/smailex.rb +2 -0
- data/lib/omniauth/smailex/version.rb +5 -0
- data/lib/omniauth/strategies/smailex.rb +30 -0
- data/omniauth-smailex.gemspec +25 -0
- metadata +112 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-smailex (0.0.1)
|
5
|
+
omniauth-oauth2 (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
faraday (0.8.7)
|
11
|
+
multipart-post (~> 1.1)
|
12
|
+
hashie (2.0.5)
|
13
|
+
httpauth (0.2.0)
|
14
|
+
jwt (0.1.8)
|
15
|
+
multi_json (>= 1.5)
|
16
|
+
multi_json (1.7.7)
|
17
|
+
multipart-post (1.2.0)
|
18
|
+
oauth2 (0.8.1)
|
19
|
+
faraday (~> 0.8)
|
20
|
+
httpauth (~> 0.1)
|
21
|
+
jwt (~> 0.1.4)
|
22
|
+
multi_json (~> 1.0)
|
23
|
+
rack (~> 1.2)
|
24
|
+
omniauth (1.1.4)
|
25
|
+
hashie (>= 1.2, < 3)
|
26
|
+
rack
|
27
|
+
omniauth-oauth2 (1.1.1)
|
28
|
+
oauth2 (~> 0.8.0)
|
29
|
+
omniauth (~> 1.0)
|
30
|
+
rack (1.4.5)
|
31
|
+
rake (10.1.0)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
bundler (~> 1.3)
|
38
|
+
omniauth-smailex!
|
39
|
+
rake
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Smailex
|
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,30 @@
|
|
1
|
+
omniauth-smailex
|
2
|
+
================
|
3
|
+
|
4
|
+
Connect to your Smailex account using OmniAuth
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'omniauth-smailex'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install omniauth-smailex
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
TODO: Write usage instructions here
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/example/server.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
begin
|
2
|
+
require 'sinatra'
|
3
|
+
require 'omniauth'
|
4
|
+
require 'omniauth-smailex'
|
5
|
+
rescue LoadError
|
6
|
+
require 'rubygems'
|
7
|
+
require 'sinatra'
|
8
|
+
require 'omniauth'
|
9
|
+
require 'omniauth-smailex'
|
10
|
+
end
|
11
|
+
|
12
|
+
use Rack::Session::Cookie
|
13
|
+
use OmniAuth::Builder do
|
14
|
+
provider :smailex,
|
15
|
+
ENV['CLIENT_ID'],
|
16
|
+
ENV['CLIENT_SECRET'],
|
17
|
+
{
|
18
|
+
:client_options => {
|
19
|
+
:site => 'http://localhost.smailex.com:8088'
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
get '/' do
|
25
|
+
<<-HTML
|
26
|
+
<a href='/auth/smailex'>Sign in with Smailex</a>
|
27
|
+
HTML
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/auth/:name/callback' do
|
31
|
+
auth = request.env['omniauth.auth']
|
32
|
+
puts auth
|
33
|
+
|
34
|
+
# do whatever you want with the information!
|
35
|
+
<<-HTML
|
36
|
+
<h1>Authenticated with Smailex!</h1>
|
37
|
+
<p>Email: #{auth["info"]["email"]}</p>
|
38
|
+
<p>Name: #{auth["info"]["name"]}</p>
|
39
|
+
HTML
|
40
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/smailex'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Smailex < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, :smailex
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => "https://smailex.com",
|
10
|
+
:authorize_url => "/oauth/authorize",
|
11
|
+
:token_url => "/oauth/token"
|
12
|
+
}
|
13
|
+
|
14
|
+
uid { raw_info["id"] }
|
15
|
+
|
16
|
+
info do
|
17
|
+
name = raw_info["default_from"]["name"] if raw_info["default_from"]
|
18
|
+
|
19
|
+
{
|
20
|
+
:name => name || raw_info["email"],
|
21
|
+
:email => raw_info["email"]
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def raw_info
|
26
|
+
@raw_info ||= access_token.get('/api/v1/users/me').parsed["user"]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/smailex/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.add_dependency 'omniauth-oauth2', '~> 1.0'
|
8
|
+
|
9
|
+
spec.name = "omniauth-smailex"
|
10
|
+
spec.version = Omniauth::Smailex::VERSION
|
11
|
+
spec.authors = ["Smailex"]
|
12
|
+
spec.email = ["<contact@smailex.com>"]
|
13
|
+
spec.description = %q{ An OmniAuth strategy for Smailex }
|
14
|
+
spec.summary = %q{ An OmniAuth strategy for Smailex }
|
15
|
+
spec.homepage = ""
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-smailex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Smailex
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: ! ' An OmniAuth strategy for Smailex '
|
63
|
+
email:
|
64
|
+
- <contact@smailex.com>
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- Gemfile.lock
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- example/server.rb
|
76
|
+
- lib/omniauth-smailex.rb
|
77
|
+
- lib/omniauth/smailex.rb
|
78
|
+
- lib/omniauth/smailex/version.rb
|
79
|
+
- lib/omniauth/strategies/smailex.rb
|
80
|
+
- omniauth-smailex.gemspec
|
81
|
+
homepage: ''
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
hash: 633733455
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
hash: 633733455
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 1.8.25
|
109
|
+
signing_key:
|
110
|
+
specification_version: 3
|
111
|
+
summary: An OmniAuth strategy for Smailex
|
112
|
+
test_files: []
|