gds-sso 18.0.0 → 18.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6450ab2114242674c0c5f9ddeba9d15cca06e538f2f211a1c621469f9fd2d9af
4
- data.tar.gz: eedc4aaa3abd89833c43af03c841f63dc6d68f9fbbd965a15aa917bc20ad933a
3
+ metadata.gz: fd40185db721bf1aed57caf86387932c0308b64d7138ae09c3489bf825fd0e30
4
+ data.tar.gz: 4bf2659c890b40cefb9b6981c029a1aabb5ded89c200a17c91ef479029c4c39a
5
5
  SHA512:
6
- metadata.gz: cfe330d97944bac31202779575770107056ca493ac5af511eb5fb316bbd4a83b459367dd683d69c01656c3e446177dabd008e47cf6d83138f29f139b7e765374
7
- data.tar.gz: 01b11032563802c91717c6418150dafadd4518f95845c938bb6ad855895971d541f1a95d59cddae92060e4896ec6fdea6620af24a72515cd9fb79074d705c3c3
6
+ metadata.gz: 293b83f8018f1318d06a2c90717ba7f76c8b23e974085a7a0bf228b911442faa9ebbcc23f78a8945752676a34058cadf80ed406aaecbc8bc789a6bcea74b7307
7
+ data.tar.gz: 2345880b44e81b65fbf04198337560e84d87cbaa7a52fb2284d0f6bf7f49561975a28436d0d6898e7b3abe2125ae4effb57822c3036043a6bc35b967e01ae73f
@@ -1,5 +1,5 @@
1
1
  module GDS
2
2
  module SSO
3
- VERSION = "18.0.0".freeze
3
+ VERSION = "18.1.0".freeze
4
4
  end
5
5
  end
@@ -4,6 +4,8 @@ require "json"
4
4
  class OmniAuth::Strategies::Gds < OmniAuth::Strategies::OAuth2
5
5
  uid { user["uid"] }
6
6
 
7
+ option :pkce, true
8
+
7
9
  info do
8
10
  {
9
11
  name: user["name"],
@@ -1,6 +1,42 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe "Authenication and authorisation" do
4
+ context "omniauth request phase" do
5
+ let(:redirect_url) { URI.parse(page.response_headers["Location"]) }
6
+ let(:authorize_params) { Rack::Utils.parse_query(redirect_url.query) }
7
+
8
+ before do
9
+ visit "/auth/gds"
10
+ end
11
+
12
+ it "includes pkce code_challenge_method in request for /oauth/authorize" do
13
+ expect(redirect_url.path).to eql("/oauth/authorize")
14
+ expect(authorize_params["code_challenge_method"]).to eq("S256")
15
+ end
16
+
17
+ it "includes pkce code_challenge in request for /oauth/authorize" do
18
+ expect(redirect_url.path).to eql("/oauth/authorize")
19
+ expect(authorize_params["code_challenge"]).to be_present
20
+ end
21
+ end
22
+
23
+ context "omniauth callback phase" do
24
+ it "includes pkce code_verifier in request for /oauth/access_token" do
25
+ visit "/auth/gds"
26
+
27
+ redirect_url = URI.parse(page.response_headers["Location"])
28
+ expect(redirect_url.path).to eql("/oauth/authorize")
29
+ state = Rack::Utils.parse_query(redirect_url.query)["state"]
30
+
31
+ stub_request(:post, "http://signon/oauth/access_token")
32
+
33
+ visit "/auth/gds/callback?state=#{state}"
34
+
35
+ expect(WebMock).to have_requested(:post, "http://signon/oauth/access_token")
36
+ .with(body: hash_including({ "code_verifier" => /.*/ }))
37
+ end
38
+ end
39
+
4
40
  context "when accessing a route that doesn't require permissions or authentication" do
5
41
  it "allows access" do
6
42
  visit "/not-restricted"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-sso
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.0.0
4
+ version: 18.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-02 00:00:00.000000000 Z
11
+ date: 2023-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0'
300
300
  requirements: []
301
- rubygems_version: 3.4.18
301
+ rubygems_version: 3.4.19
302
302
  signing_key:
303
303
  specification_version: 4
304
304
  summary: Client for GDS' OAuth 2-based SSO