firebase_token_auth 1.1.0 → 1.2.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: 0df8895c93fb21c8dfc899c0b626057b41becbf3b4af70a9dbf286938644ee44
4
- data.tar.gz: d8dbb7afac6ffad4e028e00f7981b5f2408690b23dcf2c64be838cc2fb4828cb
3
+ metadata.gz: 95fc13633c155f179c4a74a48826b61348bfeafe06a05c985fc4239c41d1a5e1
4
+ data.tar.gz: 9645adc249d87ba2be7b38edc9dd941be199e048658ea680ff6c8614457ed98b
5
5
  SHA512:
6
- metadata.gz: 432891f9eef84e16d0c8f1d8736f8cd44a0732b87b623bb6e2e0064e7c23aa69ac25a8f6031697360d6b60b99a3545caaee0ea55a29161dc2a0f8ce8024f89c7
7
- data.tar.gz: 868b4f40be681e90beabee2ccc86eb213623ef8b0f0ac2136d3e6adb546d30814f1d30ba53f0b231cc1d75795726430160a20ff7a5bcb8ac390f6d16e523e40c
6
+ metadata.gz: eb9d1699aa73a7c4bb49adaa31b3af9b0b0f779f7b495ec148aeebe47fe9bc37f541a5747ef84608b995694cc7c4e8fc8ecc081cf1c13ae265a9171de305b17a
7
+ data.tar.gz: e716f21df00f2c90571243d4e4ef9df978552ad39b9a2729a6452ae98fb164f9d6dd039ce7b3239ebd495aebd7e6c5156f4a1058e01dd905b1fc04abafb79a37
@@ -0,0 +1,56 @@
1
+ name: rspec
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ rspec:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: [ 2.4, 2.5, 2.6, 2.7, "3.0" ]
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+
14
+ - name: Set up Ruby
15
+ uses: actions/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+
19
+ - name: Configure Bundler
20
+ run: |
21
+ gem update --system
22
+ gem --version
23
+ gem install -N bundler -v 2
24
+
25
+ - uses: actions/cache@v1
26
+ with:
27
+ path: vendor/bundle
28
+ key: ${{ runner.os }}-gem-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
29
+ restore-keys: ${{ runner.os }}-gem-
30
+
31
+ - name: Install ruby dependencies
32
+ run: |
33
+ bundle check || bundle install --jobs 4 --retry 3 --path vendor/bundle
34
+
35
+ - name: rspec
36
+ run: |
37
+ bundle exec rspec
38
+ env:
39
+ TEST_UID: ${{ secrets.TEST_UID }}
40
+ TEST_PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}
41
+ TEST_WEB_API_KEY: ${{ secrets.TEST_WEB_API_KEY }}
42
+ TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
43
+ GOOGLE_ACCOUNT_TYPE: ${{ secrets.GOOGLE_ACCOUNT_TYPE }}
44
+ GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
45
+ GOOGLE_CLIENT_EMAIL: ${{ secrets.GOOGLE_CLIENT_EMAIL }}
46
+ GOOGLE_PRIVATE_KEY: ${{ secrets.GOOGLE_PRIVATE_KEY }}
47
+
48
+ - name: slack notification
49
+ uses: 8398a7/action-slack@v2
50
+ if: always()
51
+ with:
52
+ status: ${{ job.status }}
53
+ author_name: 'github action firebase_token_auth build'
54
+ env:
55
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.description = 'Firebase Authentication API wrapper for serverside. It support custom token auth. Of course it has id_token verify feature.'
11
11
  spec.homepage = 'https://github.com/miyataka/firebase_token_auth'
12
12
  spec.license = 'MIT'
13
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
14
14
 
15
15
  spec.metadata['homepage_uri'] = spec.homepage
16
16
  spec.metadata['source_code_uri'] = spec.homepage
@@ -10,13 +10,13 @@ module FirebaseTokenAuth
10
10
  end
11
11
 
12
12
  def get_account_info(params)
13
- request = Google::Apis::IdentitytoolkitV3::GetAccountInfoRequest.new({ **params })
13
+ request = Google::Apis::IdentitytoolkitV3::GetAccountInfoRequest.new(**params)
14
14
  service.get_account_info(request)
15
15
  end
16
16
 
17
17
  def update_existing_account(uid, attributes)
18
18
  update_params = { local_id: uid }.merge!(permit_attributes(attributes))
19
- request = Google::Apis::IdentitytoolkitV3::SetAccountInfoRequest.new(update_params)
19
+ request = Google::Apis::IdentitytoolkitV3::SetAccountInfoRequest.new(**update_params)
20
20
  service.set_account_info(request)
21
21
  end
22
22
 
@@ -24,7 +24,7 @@ module FirebaseTokenAuth
24
24
 
25
25
  def permit_attributes(attr_hash)
26
26
  permit_keys = %i[disabled display_name email email_verified password phone_number photo_url multi_factor]
27
- attr_hash.filter { |k, _v| permit_keys.include?(k) }
27
+ attr_hash.select { |k, _v| permit_keys.include?(k) }
28
28
  end
29
29
  end
30
30
  end
@@ -44,7 +44,7 @@ module FirebaseTokenAuth
44
44
  @private_key = OpenSSL::PKey::RSA.new(parsed['private_key'])
45
45
  @client_email = parsed['client_email']
46
46
  else
47
- @private_key = OpenSSL::PKey::RSA.new(ENV['GOOGLE_PRIVATE_KEY'])
47
+ @private_key = OpenSSL::PKey::RSA.new(unescape(ENV['GOOGLE_PRIVATE_KEY']))
48
48
  @client_email = ENV['GOOGLE_CLIENT_EMAIL']
49
49
  end
50
50
  end
@@ -52,5 +52,11 @@ module FirebaseTokenAuth
52
52
  def configured_for_custom_token?
53
53
  json_key_io || (ENV['GOOGLE_PRIVATE_KEY'] && ENV['GOOGLE_CLIENT_EMAIL'])
54
54
  end
55
+
56
+ def unescape(str)
57
+ str = str.gsub('\n', "\n")
58
+ str = str[1..-2] if str.start_with?('"') && str.end_with?('"')
59
+ str
60
+ end
55
61
  end
56
62
  end
@@ -1,3 +1,3 @@
1
1
  module FirebaseTokenAuth
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase_token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - miyataka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-18 00:00:00.000000000 Z
11
+ date: 2021-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client
@@ -46,6 +46,7 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - ".github/workflows/test.yml"
49
50
  - ".gitignore"
50
51
  - ".rspec"
51
52
  - ".rubocop.yml"
@@ -79,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - ">="
81
82
  - !ruby/object:Gem::Version
82
- version: 2.3.0
83
+ version: 2.4.0
83
84
  required_rubygems_version: !ruby/object:Gem::Requirement
84
85
  requirements:
85
86
  - - ">="