omniauth-edenred 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE.md +19 -0
- data/README.md +39 -0
- data/lib/omniauth-edenred.rb +2 -0
- data/lib/omniauth-edenred/version.rb +5 -0
- data/lib/omniauth/strategies/edenred.rb +56 -0
- data/omniauth-edenred.gemspec +18 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9425525d0ada085e5c311eb8ecc4dc2111945da9
|
4
|
+
data.tar.gz: c246474271a3de96a84fa726aa465c765933669a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6022cfe8ee9568a5b726efd76c5f7981e42d5f78d6477cf672a12166e8ee14de0c705101c705ff63652dcea148f2afc459f8014392b3783c10175de6e2d91f91
|
7
|
+
data.tar.gz: 3df5769275867689b90613009ee2fae181d09af60b5fda58a1db93578ea541bb027f6830704450fdfb4754e3e0a4adc413a51f29db036aabb3629b7898540428
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2018 Jonathan VUKOVICH TRIBOUHARET
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# OmniAuth Edenred
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/omniauth-edenred.svg)](http://badge.fury.io/rb/omniauth-edenred)
|
4
|
+
|
5
|
+
Strategy to authenticate [Edenred](https://www.edenred.fr/) in OmniAuth.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
OmniAuth Edenred is distributed as a gem, which is how it should be used in your app.
|
10
|
+
|
11
|
+
Include the gem in your Gemfile:
|
12
|
+
|
13
|
+
gem 'omniauth-edenred', '~> 1.0'
|
14
|
+
|
15
|
+
Integrate this strategy to your OmniAuth middleware.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
19
|
+
provider(
|
20
|
+
:edenred,
|
21
|
+
ENV['EDENRED_CLIENT_ID'],
|
22
|
+
ENV['EDENRED_SECRET_KEY'],
|
23
|
+
sandbox: !Rails.env.production?,
|
24
|
+
scope: 'openid edg-xp-mealdelivery-api offline_access',
|
25
|
+
authorize_params: {
|
26
|
+
acr_values: "tenant:XXXXX",
|
27
|
+
ui_locales: 'fr-FR'
|
28
|
+
}
|
29
|
+
)
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
## Author
|
34
|
+
|
35
|
+
- [Jonathan VUKOVICH TRIBOUHARET](https://github.com/jonathantribouharet) ([@johntribouharet](https://twitter.com/johntribouharet))
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
OmniAuth Edenred is released under the MIT license. See the LICENSE file for more info.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'jwt'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Edenred < OmniAuth::Strategies::OAuth2
|
7
|
+
|
8
|
+
option :name, 'edenred'
|
9
|
+
option :sandbox, false
|
10
|
+
|
11
|
+
option :client_options, {
|
12
|
+
:site => 'https://sso.auth.api.edenred.com/idsrv',
|
13
|
+
:authorize_url => 'https://sso.auth.api.edenred.com/idsrv/connect/authorize',
|
14
|
+
:token_url => 'https://sso.auth.api.edenred.com/idsrv/connect/token',
|
15
|
+
}
|
16
|
+
|
17
|
+
def setup_phase
|
18
|
+
super
|
19
|
+
|
20
|
+
if options[:sandbox] === true
|
21
|
+
options[:client_options] = {
|
22
|
+
:site => 'https://sso.auth-sandbox.api.edenred.com/idsrv',
|
23
|
+
:authorize_url => 'https://sso.auth-sandbox.api.edenred.com/idsrv/connect/authorize',
|
24
|
+
:token_url => 'https://sso.auth-sandbox.api.edenred.com/idsrv/connect/token',
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
uid { raw_info['username'] }
|
30
|
+
|
31
|
+
info do
|
32
|
+
{
|
33
|
+
:name => raw_info['username'],
|
34
|
+
:email => raw_info['username'],
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
extra do
|
39
|
+
{
|
40
|
+
'raw_info' => raw_info
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def raw_info
|
45
|
+
@raw_info ||= JWT.decode(access_token.params['id_token'], nil, false).first
|
46
|
+
end
|
47
|
+
|
48
|
+
# Required for omniauth-oauth2 >= 1.4
|
49
|
+
# https://github.com/intridea/omniauth-oauth2/issues/81
|
50
|
+
def callback_url
|
51
|
+
full_host + script_name + callback_path
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path("../lib/omniauth-edenred/version", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "omniauth-edenred"
|
5
|
+
gem.summary = "OmniAuth Strategy for Edenred via OAuth2"
|
6
|
+
gem.description = "OmniAuth Strategy for Edenred via OAuth2"
|
7
|
+
gem.homepage = "https://github.com/jonathantribouharet/omniauth-edenred"
|
8
|
+
gem.version = OmniAuth::Edenred::VERSION
|
9
|
+
gem.files = `git ls-files`.split("\n")
|
10
|
+
gem.require_paths = ["lib"]
|
11
|
+
gem.authors = ['Jonathan VUKOVICH TRIBOUHARET']
|
12
|
+
gem.email = 'jonathan.tribouharet@gmail.com'
|
13
|
+
gem.license = 'MIT'
|
14
|
+
gem.platform = Gem::Platform::RUBY
|
15
|
+
|
16
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.4'
|
17
|
+
gem.add_dependency 'jwt'
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-edenred
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonathan VUKOVICH TRIBOUHARET
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jwt
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: OmniAuth Strategy for Edenred via OAuth2
|
42
|
+
email: jonathan.tribouharet@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- Gemfile
|
48
|
+
- LICENSE.md
|
49
|
+
- README.md
|
50
|
+
- lib/omniauth-edenred.rb
|
51
|
+
- lib/omniauth-edenred/version.rb
|
52
|
+
- lib/omniauth/strategies/edenred.rb
|
53
|
+
- omniauth-edenred.gemspec
|
54
|
+
homepage: https://github.com/jonathantribouharet/omniauth-edenred
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.5.2
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: OmniAuth Strategy for Edenred via OAuth2
|
78
|
+
test_files: []
|