audiences 1.3.1 → 1.5.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: 319c6d5a55900512c509f3e27ac9e03489734e0a618c31414cb7cd57981fc916
4
- data.tar.gz: 2a117b18cd56209481ead18fafccb7ba9b57b673b5cdfa5c0f03152184704e25
3
+ metadata.gz: 0ad8b73e8fd9085a26bf9c1ce06d86baf2b689077aab8d33c6962ea800eb2f31
4
+ data.tar.gz: 2f27b364f3cadf67c4e17280e059319119c016c10ebe73a033d9cee93d812ef5
5
5
  SHA512:
6
- metadata.gz: d08f9b199ae6ca61caeaff91606bb4a9cf21a171f17486a2919631a7b791ad37995a9645527199704d6ec8eb24ca4a1fba8543829dbd97f47c73174c9ba766f5
7
- data.tar.gz: b1d6cc6305467c94bddb4abab023e451de05e2d9177f19c0a358da81429c6930c8381a6066afa6703f1826f4f6e0cb2bd5afed94a0cbba97c3816325b540e29b
6
+ metadata.gz: 198228dfcd7a392a1594fb0d7940fea900e21b67f061c80035faee586e16eab6b25b2fe715beaf8483964cce0a5280151c2fe494e1da4ee7be310458a0259030
7
+ data.tar.gz: 20096d2c12c819d26677d345d7560fda479f312807b0be9130c31396e7cb7d55d5d86304668b017604671ed23c4f9cc2837727e7239c4823d83c4e463f2d6e70
@@ -2,5 +2,14 @@
2
2
 
3
3
  module Audiences
4
4
  class ApplicationController < ActionController::API
5
+ before_action unless: :authenticate! do
6
+ render json: { error: "Unauthorized" }, status: :unauthorized
7
+ end
8
+
9
+ private
10
+
11
+ def authenticate!
12
+ instance_exec(request, &Audiences.config.authenticate)
13
+ end
5
14
  end
6
15
  end
@@ -4,7 +4,11 @@ module Audiences
4
4
  class ScimProxyController < ApplicationController
5
5
  def get
6
6
  resources = Audiences::Scim.resource(params[:scim_path].to_sym)
7
- .query(filter: params[:filter], startIndex: params[:startIndex], count: params[:count])
7
+ .query(
8
+ filter: "displayName co \"#{params[:filter]}\"",
9
+ startIndex: params[:startIndex], count: params[:count],
10
+ attributes: %w[id externalId displayName photos]
11
+ )
8
12
 
9
13
  render json: resources, except: %w[schemas meta]
10
14
  end
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Unreleased
2
2
 
3
+ # Version 1.5.0 (2024-12-12)
4
+
5
+ - SCIM proxy will only return data used by the UI [#451](https://github.com/powerhome/audiences/pull/451)
6
+
7
+ # Version 1.4.0 (2024-11-01)
8
+
9
+ - Add authentication hooks for Audiences controllers [#438](https://github.com/powerhome/audiences/pull/438)
10
+
3
11
  # Version 1.3.1 (2024-10-11)
4
12
 
5
13
  - Forward pagination parameters to SCIM on proxy [#397](https://github.com/powerhome/audiences/pull/397)
@@ -5,6 +5,34 @@ module Audiences
5
5
 
6
6
  # Configuration options
7
7
 
8
+ #
9
+ # Authentication configuration. This defaults to true, meaning that the audiences
10
+ # endpoints are open to the public.
11
+ #
12
+ # To authenticate requests, set this configuration to a lambda that will receive
13
+ # the request and return true if the request is authenticated.
14
+ #
15
+ # Raising an exception will also prevent the execution of the request, but the
16
+ # exception will not be caught and should be handled by the application middlewares.
17
+ #
18
+ # I.e.:
19
+ #
20
+ # Audiences.configure do |config|
21
+ # config.authentication = ->(*) { authenticate_request }
22
+ # end
23
+ #
24
+ # I.e:
25
+ #
26
+ # Audiences.configure do |config|
27
+ # config.authentication = ->(request) do
28
+ # request.env["warden"].authenticate!
29
+ # end
30
+ # end
31
+ #
32
+ config_accessor :authentication do
33
+ ->(*) { true }
34
+ end
35
+
8
36
  #
9
37
  # Identity model representing a SCIM User in the current application. I.e.: "User"
10
38
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Audiences
4
- VERSION = "1.3.1"
4
+ VERSION = "1.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audiences
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Palhares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-14 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.5.16
96
+ rubygems_version: 3.5.22
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Audiences system