oauth_im 0.12.1 → 0.13.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: d76c8274bed6bd0f1186d0f91c3f19d1f4c9c3f33fb76f42aabef39aa8e69abc
4
- data.tar.gz: 7aa343de7cd28ba873083f234c8af2129673bf1f362fcbedc48749ed637f8e26
3
+ metadata.gz: 21c49f432ffef807fecc90eb4e676bdb8ca1aba6523eaf82421d817f519f4eac
4
+ data.tar.gz: 5bc900d0b0227686df48bf2ae06fd1517c5376d5e5f6bf265d8894b87fad0d37
5
5
  SHA512:
6
- metadata.gz: 16ef3dc4382aef3277073f88ad5acacbff0cb036c7dcf971d207b03bc29ef2e3e455a73c90e954426c1b81e5117c6cbeb30af28f7ca12db84045e3271282ae23
7
- data.tar.gz: 5e270df61e8e55069d2c788347e26492c359ed0fcbc3dcc38707e5bd60098e6e2ce8ef95e184e5d5167828a601f46bbaa03917b461068c7130c6f261bfa97f43
6
+ metadata.gz: 577dda1cad914c4f3013834f6e674ef6476624347af8a3aab91dae76ecf3e4dd6403e4edd78cecfd06161d0f96d29fb80da26921f233947264238bef49f54711
7
+ data.tar.gz: 4d778e7f5800e8b33f9d55fb90b890c34002d9b5619c53a337612e7bd10a1796644b962e446ce9426248d47e629ae8de2591022232930e0223dade039fb26273
@@ -4,9 +4,14 @@ require 'oauth2'
4
4
 
5
5
  module OauthIm
6
6
  class ClientController < OauthIm::ApplicationController
7
+ delegate :oauth_rescue_redirect_path, to: :configuration
8
+
7
9
  def callback
8
10
  session[:user_jwt] = user_jwt
9
11
  redirect_to main_app.root_path
12
+ rescue StandardError => e
13
+ Rollbar.warning "rescue OauthIm::ClientController#callback: #{request.original_url} #{e.message}"
14
+ redirect_to oauth_rescue_redirect_path
10
15
  end
11
16
 
12
17
  def login
@@ -4,17 +4,11 @@ require 'fusionauth/fusionauth_client'
4
4
 
5
5
  module OauthIm
6
6
  class AdminClient < IdpClient
7
- def search_for(term: '', email: '', limit: 25, offset: 0)
7
+ def search_for(term: '', email: '', query: nil, limit: 25, offset: 0)
8
8
  if email.present?
9
9
  proxy_users_for client.retrieve_user_by_email(email)
10
- elsif term.present?
11
- proxy_users_for client.search_users_by_query(
12
- search: {
13
- numberOfResults: limit,
14
- queryString: term,
15
- startRow: offset
16
- }
17
- )
10
+ elsif term.present? || query.present?
11
+ search term: term, query: query, limit: limit, offset: offset
18
12
  else
19
13
  []
20
14
  end
@@ -43,5 +37,22 @@ module OauthIm
43
37
  def proxy_users_for(response)
44
38
  user_attrs_for(response).map { |attrs| ProxyUser.new(attrs) }
45
39
  end
40
+
41
+ def search(term:, query:, limit:, offset:)
42
+ proxy_users_for client.search_users_by_query(
43
+ search: search_params(
44
+ term: term, query: query, limit: limit, offset: offset
45
+ )
46
+ )
47
+ end
48
+
49
+ def search_params(term:, query:, limit:, offset:)
50
+ {
51
+ numberOfResults: limit,
52
+ startRow: offset,
53
+ queryString: term,
54
+ query: query&.to_json
55
+ }.reject { |_key, val| val.blank? }
56
+ end
46
57
  end
47
58
  end
@@ -17,6 +17,7 @@ module OauthIm
17
17
  client_secret
18
18
  hmac
19
19
  rsa_public
20
+ oauth_rescue_redirect_path
20
21
  ].freeze
21
22
 
22
23
  class Configuration
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OauthIm
4
- VERSION = '0.12.1'
4
+ VERSION = '0.13.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth_im
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Connally