omniauth-dex-energy 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -11
- data/bin/publish-gem +1 -3
- data/examples/sinatra/Gemfile.lock +5 -5
- data/examples/sinatra/app.rb +9 -2
- data/lib/omniauth/strategies/dex_energy.rb +15 -1
- data/omniauth-dex-energy.gemspec +3 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dbe074b75d13e2fcf1e9eb2cc415f4fe585f4a9052dbb7f5692174cdd09c30a
|
4
|
+
data.tar.gz: f2458ef0c2c3c17b18a43b28e1cadcee00eee3061289ab574bd500f56c30c442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55565e958123c8652f7869acb2f5f39daae32f46f6745afe23f45af2e9c0fbd2f318d8446e61686d315029aedad2906389e8b75a47f220f3fafbc4d0af659583
|
7
|
+
data.tar.gz: 94e73012a8600ab4cdb63677bf27938a9dd1d93da0882680add3f51d6d5ebb4963a5231571ca56a7267769c0ad4b38852c37d9aecdcf1c9fbbb5d9af12fc5ddb
|
data/README.md
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
# omniauth-dex-energy
|
2
2
|
|
3
3
|
![CI](https://github.com/greensync/omniauth-dex-energy/workflows/CI/badge.svg)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/omniauth-dex-energy.png)](https://badge.fury.io/rb/omniauth-dex-energy)
|
4
5
|
|
5
6
|
An OmniAuth strategy to authenticate with deX.
|
6
7
|
|
7
8
|
## Table of Contents
|
8
9
|
|
9
10
|
- [omniauth-dex-energy](#omniauth-dex-energy)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
- [Table of Contents](#table-of-contents)
|
12
|
+
- [Installation](#installation)
|
13
|
+
- [Usage](#usage)
|
14
|
+
- [First Steps](#first-steps)
|
15
|
+
- [Sinatra](#sinatra)
|
16
|
+
- [Development](#development)
|
17
|
+
- [Releasing a new version](#releasing-a-new-version)
|
18
|
+
- [Contributing](#contributing)
|
19
|
+
- [License](#license)
|
18
20
|
|
19
21
|
## Installation
|
20
22
|
|
@@ -26,11 +28,15 @@ gem 'omniauth-dex-energy'
|
|
26
28
|
|
27
29
|
And then execute:
|
28
30
|
|
29
|
-
|
31
|
+
```sh
|
32
|
+
bundle install
|
33
|
+
```
|
30
34
|
|
31
35
|
Or install it yourself as:
|
32
36
|
|
33
|
-
|
37
|
+
```sh
|
38
|
+
gem install omniauth-dex-energy
|
39
|
+
```
|
34
40
|
|
35
41
|
## Usage
|
36
42
|
|
@@ -59,7 +65,16 @@ bundle exec foreman start
|
|
59
65
|
|
60
66
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
61
67
|
|
62
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
68
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
69
|
+
|
70
|
+
### Releasing a new version
|
71
|
+
|
72
|
+
First, create and push a git tag off HEAD.
|
73
|
+
|
74
|
+
- bump `version.rb`; commit and push
|
75
|
+
- run `bin/publish-gem`
|
76
|
+
|
77
|
+
This will publish the gem to [rubygems.org](https://rubygems.org).
|
63
78
|
|
64
79
|
## Contributing
|
65
80
|
|
data/bin/publish-gem
CHANGED
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
mustermann (1.1.0)
|
12
12
|
ruby2_keywords (~> 0.0.1)
|
13
13
|
nio4r (2.5.2)
|
14
|
-
oauth2 (1.4.
|
14
|
+
oauth2 (1.4.4)
|
15
15
|
faraday (>= 0.8, < 2.0)
|
16
16
|
jwt (>= 1.0, < 3.0)
|
17
17
|
multi_json (~> 1.3)
|
@@ -20,12 +20,12 @@ GEM
|
|
20
20
|
omniauth (1.9.0)
|
21
21
|
hashie (>= 3.4.6, < 3.7.0)
|
22
22
|
rack (>= 1.6.2, < 3)
|
23
|
-
omniauth-dex-energy (0.1.
|
24
|
-
omniauth-oauth2 (~> 1.6
|
23
|
+
omniauth-dex-energy (0.1.1)
|
24
|
+
omniauth-oauth2 (~> 1.6)
|
25
25
|
omniauth-oauth2 (1.6.0)
|
26
26
|
oauth2 (~> 1.1)
|
27
27
|
omniauth (~> 1.9)
|
28
|
-
puma (4.3.
|
28
|
+
puma (4.3.3)
|
29
29
|
nio4r (~> 2.0)
|
30
30
|
rack (2.2.2)
|
31
31
|
rack-protection (2.0.8.1)
|
@@ -53,4 +53,4 @@ DEPENDENCIES
|
|
53
53
|
slim
|
54
54
|
|
55
55
|
BUNDLED WITH
|
56
|
-
2.1.
|
56
|
+
2.1.4
|
data/examples/sinatra/app.rb
CHANGED
@@ -31,7 +31,14 @@ get '/auth/dex_energy/callback' do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
get '/logout' do
|
34
|
-
# Log the user out of their session in the app
|
34
|
+
# Log the user out of their session in the app, and then redirect them to the IdP
|
35
|
+
# so that it can log them out.
|
36
|
+
# The user will be redirect back to us afterwards.
|
35
37
|
session.delete(:user)
|
36
|
-
|
38
|
+
|
39
|
+
logout_url = OmniAuth::Strategies::DexEnergy.logout_uri(
|
40
|
+
client_id: oauth2_client_id,
|
41
|
+
redirect_uri: to('/'),
|
42
|
+
)
|
43
|
+
redirect logout_url
|
37
44
|
end
|
@@ -6,9 +6,13 @@ require 'omniauth-oauth2'
|
|
6
6
|
module OmniAuth
|
7
7
|
module Strategies
|
8
8
|
class DexEnergy < OmniAuth::Strategies::OAuth2
|
9
|
+
DEFAULT_SITE = 'https://who.dex.energy'
|
10
|
+
|
9
11
|
option :name, 'dex_energy'
|
10
12
|
|
11
|
-
option :client_options, site:
|
13
|
+
option :client_options, site: DEFAULT_SITE, auth_scheme: :basic_auth
|
14
|
+
|
15
|
+
option :authorize_params, scope: 'openid'
|
12
16
|
|
13
17
|
uid do
|
14
18
|
raw_info['sub']
|
@@ -26,6 +30,16 @@ module OmniAuth
|
|
26
30
|
}
|
27
31
|
end
|
28
32
|
|
33
|
+
class << self
|
34
|
+
def logout_uri(client_id:, redirect_uri:, site: nil)
|
35
|
+
site ||= DEFAULT_SITE
|
36
|
+
|
37
|
+
encoded_redirect_uri = URI.encode_www_form_component(redirect_uri)
|
38
|
+
|
39
|
+
"#{site}/oauth/logout?client_id=#{client_id}&redirect_uri=#{encoded_redirect_uri}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
29
43
|
private
|
30
44
|
|
31
45
|
def raw_info
|
data/omniauth-dex-energy.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'omniauth-dex-energy'
|
7
|
-
spec.version =
|
7
|
+
spec.version = VERSION
|
8
8
|
spec.authors = ['Cera Davies', 'Nick Burgin', 'Mike Williams']
|
9
9
|
spec.email = [
|
10
10
|
'internalplatform@greensync.com.au',
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
35
35
|
spec.add_development_dependency 'pry-byebug', '~> 3.8.0'
|
36
|
-
spec.add_development_dependency 'rack', '~>
|
36
|
+
spec.add_development_dependency 'rack', '~> 2.2.3'
|
37
37
|
spec.add_development_dependency 'rake', '~> 12.0'
|
38
38
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
39
39
|
spec.add_development_dependency 'rubocop', '~> 0.77'
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-dex-energy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cera Davies
|
8
8
|
- Nick Burgin
|
9
9
|
- Mike Williams
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: omniauth-oauth2
|
@@ -60,14 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: 2.2.3
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: 2.2.3
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: rake
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,7 +152,7 @@ metadata:
|
|
152
152
|
homepage_uri: https://github.com/greensync/omniauth-dex-energy
|
153
153
|
source_code_uri: https://github.com/greensync/omniauth-dex-energy
|
154
154
|
changelog_uri: https://github.com/greensync/omniauth-dex-energy/releases
|
155
|
-
post_install_message:
|
155
|
+
post_install_message:
|
156
156
|
rdoc_options: []
|
157
157
|
require_paths:
|
158
158
|
- lib
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
170
|
rubygems_version: 3.0.3
|
171
|
-
signing_key:
|
171
|
+
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: an OmniAuth strategy for authenticating with deX
|
174
174
|
test_files: []
|