Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-omniauth-google-oauth2 for 
openSUSE:Factory checked in at 2022-04-30 22:52:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-omniauth-google-oauth2 (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-omniauth-google-oauth2.new.1538 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-omniauth-google-oauth2"

Sat Apr 30 22:52:37 2022 rev:10 rq:974060 version:1.0.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/rubygem-omniauth-google-oauth2/rubygem-omniauth-google-oauth2.changes
    2021-07-02 13:28:43.244176965 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-omniauth-google-oauth2.new.1538/rubygem-omniauth-google-oauth2.changes
  2022-04-30 22:52:50.164248462 +0200
@@ -1,0 +2,22 @@
+Thu Apr 28 05:39:14 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 1.0.1
+ see installed CHANGELOG.md
+
+  ## 1.0.1 - 2022-03-10
+  
+  ### Added
+  - Output granted scopes in credentials block of the auth hash.
+  - Migrated to GitHub actions.
+  
+  ### Deprecated
+  - Nothing.
+  
+  ### Removed
+  - Nothing.
+  
+  ### Fixed
+  - Overriding the `redirect_uri` via params or JSON request body.
+  
+
+-------------------------------------------------------------------

Old:
----
  omniauth-google-oauth2-1.0.0.gem

New:
----
  omniauth-google-oauth2-1.0.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-omniauth-google-oauth2.spec ++++++
--- /var/tmp/diff_new_pack.8Zp5Zi/_old  2022-04-30 22:52:50.780249296 +0200
+++ /var/tmp/diff_new_pack.8Zp5Zi/_new  2022-04-30 22:52:50.784249301 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-omniauth-google-oauth2
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-omniauth-google-oauth2
-Version:        1.0.0
+Version:        1.0.1
 Release:        0
 %define mod_name omniauth-google-oauth2
 %define mod_full_name %{mod_name}-%{version}

++++++ omniauth-google-oauth2-1.0.0.gem -> omniauth-google-oauth2-1.0.1.gem 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.github/workflows/ci.yml new/.github/workflows/ci.yml
--- old/.github/workflows/ci.yml        1970-01-01 01:00:00.000000000 +0100
+++ new/.github/workflows/ci.yml        2022-03-11 03:54:09.000000000 +0100
@@ -0,0 +1,21 @@
+name: CI 
+
+on: [push, pull_request]
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Ruby ${{ matrix.ruby-version }}
+      uses: ruby/setup-ruby@v1
+      with:
+        ruby-version: ${{ matrix.ruby-version }}
+        bundler-cache: true # 'bundle install' and cache
+    - name: Run specs 
+      run: |
+        bundle exec rake
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml     2021-03-15 05:08:01.000000000 +0100
+++ new/.travis.yml     2022-03-11 03:54:09.000000000 +0100
@@ -1,6 +1,9 @@
 language: ruby
 cache: bundler
 rvm:
-  - '2.3.4'
-  - '2.4.1'
-  - '2.5.0'
+  - '2.3.8'
+  - '2.4.10'
+  - '2.5.8'
+  - '2.6.6'
+  - '2.7.2'
+  - '3.0.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2021-03-15 05:08:01.000000000 +0100
+++ new/CHANGELOG.md    2022-03-11 03:54:09.000000000 +0100
@@ -1,6 +1,21 @@
 # Changelog
 All notable changes to this project will be documented in this file.
 
+## 1.0.1 - 2022-03-10
+
+### Added
+- Output granted scopes in credentials block of the auth hash.
+- Migrated to GitHub actions.
+
+### Deprecated
+- Nothing.
+
+### Removed
+- Nothing.
+
+### Fixed
+- Overriding the `redirect_uri` via params or JSON request body.
+
 ## 1.0.0 - 2021-03-14
 
 ### Added
@@ -10,7 +25,7 @@
 - Nothing.
 
 ### Removed
-- Support for Omniauth 1.x
+- Support for Omniauth 1.x.
 
 ### Fixed
 - Nothing.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2021-03-15 05:08:01.000000000 +0100
+++ new/README.md       2022-03-11 03:54:09.000000000 +0100
@@ -1,5 +1,4 @@
 [![Gem 
Version](https://badge.fury.io/rb/omniauth-google-oauth2.svg)](https://badge.fury.io/rb/omniauth-google-oauth2)
-[![Build 
Status](https://travis-ci.org/zquestz/omniauth-google-oauth2.svg)](https://travis-ci.org/zquestz/omniauth-google-oauth2)
 
 # OmniAuth Google OAuth2 Strategy
 
@@ -34,6 +33,7 @@
 Rails.application.config.middleware.use OmniAuth::Builder do
   provider :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET']
 end
+OmniAuth.config.allowed_request_methods = %i[get]
 ```
 
 You can now access the OmniAuth Google OAuth2 URL: `/auth/google_oauth2`
@@ -217,6 +217,10 @@
 For your views you can login using:
 
 ```erb
+<%# omniauth-google-oauth2 1.0.x uses OmniAuth 2 and requires using HTTP Post 
to initiate authentication: %>
+<%= link_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path, 
method: :post %>
+
+<%# omniauth-google-oauth2 prior 1.0.0: %>
 <%= link_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path 
%>
 
 <%# Devise prior 4.1.0: %>
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/examples/Gemfile new/examples/Gemfile
--- old/examples/Gemfile        2021-03-15 05:08:01.000000000 +0100
+++ new/examples/Gemfile        2022-03-11 03:54:09.000000000 +0100
@@ -5,3 +5,4 @@
 gem 'omniauth-google-oauth2', '~> 0.8.1'
 gem 'rubocop'
 gem 'sinatra', '~> 1.4'
+gem 'webrick'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/omniauth/google_oauth2/version.rb 
new/lib/omniauth/google_oauth2/version.rb
--- old/lib/omniauth/google_oauth2/version.rb   2021-03-15 05:08:01.000000000 
+0100
+++ new/lib/omniauth/google_oauth2/version.rb   2022-03-11 03:54:09.000000000 
+0100
@@ -2,6 +2,6 @@
 
 module OmniAuth
   module GoogleOauth2
-    VERSION = '1.0.0'
+    VERSION = '1.0.1'
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/omniauth/strategies/google_oauth2.rb 
new/lib/omniauth/strategies/google_oauth2.rb
--- old/lib/omniauth/strategies/google_oauth2.rb        2021-03-15 
05:08:01.000000000 +0100
+++ new/lib/omniauth/strategies/google_oauth2.rb        2022-03-11 
03:54:09.000000000 +0100
@@ -60,6 +60,11 @@
         )
       end
 
+      credentials do
+        # Tokens and expiration will be used from OAuth2 strategy credentials 
block
+        prune!({ 'scope' => token_info(access_token.token)['scope'] })
+      end
+
       extra do
         hash = {}
         hash[:id_token] = access_token['id_token']
@@ -121,8 +126,9 @@
             request.body.rewind # rewind request body for downstream 
middlewares
             verifier = body && body['code']
             access_token = body && body['access_token']
+            redirect_uri ||= body && body['redirect_uri']
             if verifier
-              client_get_token(verifier, 'postmessage')
+              client_get_token(verifier, redirect_uri || 'postmessage')
             elsif verify_token(access_token)
               ::OAuth2::AccessToken.from_hash(client, body.dup)
             end
@@ -214,12 +220,21 @@
         URI.encode_www_form(stripped_params)
       end
 
+      def token_info(access_token)
+        return nil unless access_token
+
+        @token_info ||= Hash.new do |h, k|
+          h[k] = client.request(:get, 
'https://www.googleapis.com/oauth2/v3/tokeninfo', params: { access_token: 
access_token }).parsed
+        end
+
+        @token_info[access_token]
+      end
+
       def verify_token(access_token)
         return false unless access_token
 
-        raw_response = client.request(:get, 
'https://www.googleapis.com/oauth2/v3/tokeninfo',
-                                      params: { access_token: access_token 
}).parsed
-        raw_response['aud'] == options.client_id || 
options.authorized_client_ids.include?(raw_response['aud'])
+        token_info = token_info(access_token)
+        token_info['aud'] == options.client_id || 
options.authorized_client_ids.include?(token_info['aud'])
       end
 
       def verify_hd(access_token)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-03-15 05:08:01.000000000 +0100
+++ new/metadata        2022-03-11 03:54:09.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: omniauth-google-oauth2
 version: !ruby/object:Gem::Version
-  version: 1.0.0
+  version: 1.0.1
 platform: ruby
 authors:
 - Josh Ellithorpe
@@ -9,7 +9,7 @@
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2021-03-15 00:00:00.000000000 Z
+date: 2022-03-11 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: jwt
@@ -117,6 +117,7 @@
 extensions: []
 extra_rdoc_files: []
 files:
+- ".github/workflows/ci.yml"
 - ".gitignore"
 - ".rubocop.yml"
 - ".travis.yml"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/omniauth/strategies/google_oauth2_spec.rb 
new/spec/omniauth/strategies/google_oauth2_spec.rb
--- old/spec/omniauth/strategies/google_oauth2_spec.rb  2021-03-15 
05:08:01.000000000 +0100
+++ new/spec/omniauth/strategies/google_oauth2_spec.rb  2022-03-11 
03:54:09.000000000 +0100
@@ -347,6 +347,37 @@
     end
   end
 
+  describe '#credentials' do
+    let(:client) { OAuth2::Client.new('abc', 'def') }
+    let(:access_token) { OAuth2::AccessToken.from_hash(client, access_token: 
'valid_access_token', expires_at: 123_456_789, refresh_token: 
'valid_refresh_token') }
+    before(:each) do
+      allow(subject).to receive(:access_token).and_return(access_token)
+      subject.options.client_options[:connection_build] = proc do |builder|
+        builder.request :url_encoded
+        builder.adapter :test do |stub|
+          stub.get('/oauth2/v3/tokeninfo?access_token=valid_access_token') do
+            [200, { 'Content-Type' => 'application/json; charset=UTF-8' }, 
JSON.dump(
+              aud: '000000000000.apps.googleusercontent.com',
+              sub: '123456789',
+              scope: 'profile email'
+            )]
+          end
+        end
+      end
+    end
+
+    it 'should return access token and (optionally) refresh token' do
+      expect(subject.credentials.to_h).to \
+        match(hash_including(
+                'token' => 'valid_access_token',
+                'refresh_token' => 'valid_refresh_token',
+                'scope' => 'profile email',
+                'expires_at' => 123_456_789,
+                'expires' => true
+              ))
+    end
+  end
+
   describe '#extra' do
     let(:client) do
       OAuth2::Client.new('abc', 'def') do |builder|
@@ -640,6 +671,22 @@
 
       subject.build_access_token
     end
+
+    it 'reads the redirect uri from a json request body' do
+      body = StringIO.new(%({"code":"json_access_token", 
"redirect_uri":"sample"}))
+      client = double(:client)
+      auth_code = double(:auth_code)
+
+      allow(request).to receive(:xhr?).and_return(false)
+      allow(request).to receive(:content_type).and_return('application/json')
+      allow(request).to receive(:body).and_return(body)
+      allow(client).to receive(:auth_code).and_return(auth_code)
+      expect(subject).to receive(:client).and_return(client)
+
+      expect(auth_code).to receive(:get_token).with('json_access_token', { 
redirect_uri: 'sample' }, {})
+
+      subject.build_access_token
+    end
 
     it 'reads the access token from a json request body' do
       body = StringIO.new(%({"access_token":"valid_access_token"}))

Reply via email to