omniauth-dex-energy 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db21340318e6c6ec779b2ec49ceb443b2081d28d1f8a00f93609cf586ae99214
4
- data.tar.gz: a173e8118f3c4f21d144b01ca4abdcce995b043ac3a50a2af7b0f7af41ed5c59
3
+ metadata.gz: 5dbe074b75d13e2fcf1e9eb2cc415f4fe585f4a9052dbb7f5692174cdd09c30a
4
+ data.tar.gz: f2458ef0c2c3c17b18a43b28e1cadcee00eee3061289ab574bd500f56c30c442
5
5
  SHA512:
6
- metadata.gz: 15ee58797637d3598e51a380bb51f8e5fda5027f6fac39a5cd3648da7422b11e640e0413bc6ff8903a1490bc97b2e0734ab013b6dff05427961dc654645867e4
7
- data.tar.gz: ce2d105652dae81d7146be104b2648ce6476c51941cf16f38c037c161b6ecaeed487da52161bb820f9487ba122fa5975cc264dbdf80c70648bdbcc8b7355f2e7
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
- - [Table of Contents](#table-of-contents)
11
- - [Installation](#installation)
12
- - [Usage](#usage)
13
- - [First Steps](#first-steps)
14
- - [Sinatra](#sinatra)
15
- - [Development](#development)
16
- - [Contributing](#contributing)
17
- - [License](#license)
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
- $ bundle install
31
+ ```sh
32
+ bundle install
33
+ ```
30
34
 
31
35
  Or install it yourself as:
32
36
 
33
- $ gem install omniauth-dex-energy
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`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
 
@@ -2,7 +2,5 @@
2
2
 
3
3
  set -Eeuo pipefail
4
4
 
5
- version=$(git describe --exact-match HEAD)
6
-
7
5
  gem build omniauth-dex-energy
8
- gem push omniauth-dex-energy-${version}.gem
6
+ gem push omniauth-dex-energy-*.gem
@@ -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.3)
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.0)
24
- omniauth-oauth2 (~> 1.6.0)
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.1)
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.2
56
+ 2.1.4
@@ -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 - but not in the Identity Provider.
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
- redirect request.referrer
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: 'https://who.dex.energy', auth_scheme: :basic_auth
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
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- gem_version = `git describe --exact-match HEAD`.strip
3
+ require_relative 'version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'omniauth-dex-energy'
7
- spec.version = gem_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', '~> 1.6.0'
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.1.1
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-02-28 00:00:00.000000000 Z
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: 1.6.0
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: 1.6.0
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: []