two_percent 0.1.0 → 0.3.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: 4f53693df02a8df3cf51bee1e388a7cf906cf102f9bc2a6dcbcc32ea452573ae
4
- data.tar.gz: ff471ecd9cdb05937625bbcf4b727680e0f825a38db684d31b39980555d291a5
3
+ metadata.gz: 9c5a241a697109d794c29fbac31f4ecd363b883dd70f0a2d22bec5a94bdccb98
4
+ data.tar.gz: 539239a87f4b1ca23c84b7d3080db2104db74fa09a2f906a41b3cac168e7c91b
5
5
  SHA512:
6
- metadata.gz: 83b9bb1632b295c695b713d3a38510ab7b3a4ed03c8628aeb65c10d8adff9cd25a702590cd38066d459b6df054fe6af906ffd4ac3847d4b3663dd6f1b24662a7
7
- data.tar.gz: 6f9992d6ca99572635d318a7f9b90174f57ec5ffede4a60a6cb2646838cfad7cdcf33bd3de17a1941320bbaa8dd468f2e7474a0381597718cd045e1032474a8a
6
+ metadata.gz: 470b871f02fb8a5d125fb80c371186fe0301b69293b4e8a00ac9353906c8287f137b33310feee56f32c936faf5215e8801f83ed0cb72c9cbd1b5e3de4c7c4c10
7
+ data.tar.gz: 9b4957e2a180f5ae6c1fc8314138b134d6b219997ec754846d3296920efe84f00981ab555f494608428f03adab1bf2dff4d35cd8ce56758c61a1bd4050ecec83
@@ -2,6 +2,8 @@
2
2
 
3
3
  module TwoPercent
4
4
  class ScimController < ApplicationController
5
+ before_action :authenticate
6
+
5
7
  def create
6
8
  TwoPercent::CreateEvent.create(resource: params[:resource_type], params: scim_params)
7
9
 
@@ -29,7 +31,11 @@ module TwoPercent
29
31
  private
30
32
 
31
33
  def scim_params
32
- params.except(:controller, :action, :resource_type, :id).as_json.deep_symbolize_keys
34
+ params.except(:controller, :action, :resource_type).as_json.deep_symbolize_keys
35
+ end
36
+
37
+ def authenticate
38
+ instance_exec(&TwoPercent.config.authenticate)
33
39
  end
34
40
  end
35
41
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TwoPercent
4
+ include ActiveSupport::Configurable
5
+
6
+ # Configuration options
7
+
8
+ #
9
+ # Authentication configuration. This defaults to true, meaning that the SCIM
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
+ # TwoPercent.configure do |config|
21
+ # config.authenticate = ->(*) { authenticate_request }
22
+ # end
23
+ #
24
+ # I.e:
25
+ #
26
+ # TwoPercent.configure do |config|
27
+ # config.authenticate = ->(request) do
28
+ # request.env["warden"].authenticate!
29
+ # end
30
+ # end
31
+ #
32
+ config_accessor :authenticate do
33
+ ->(*) { true }
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TwoPercent
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/two_percent.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require "aether_observatory"
4
4
 
5
5
  require "two_percent/version"
6
+ require "two_percent/configuration"
6
7
 
7
8
  module TwoPercent
8
- # Your code goes here...
9
9
  end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: two_percent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Palhares
8
8
  - Katie Edgar
9
9
  - Dan Smith
10
- - Denis Zablotskii
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2025-03-25 00:00:00.000000000 Z
13
+ date: 2025-05-07 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: aether_observatory
@@ -45,9 +44,8 @@ description: Adds a thin SCIM interface, and delegates the actions taken on writ
45
44
  calls to observers
46
45
  email:
47
46
  - carlos.palhares@powerhrg.com
48
- - katie.edgar@powerhrg.com
47
+ - katie.weber@powerhrg.com
49
48
  - dsmith@powerhrg.com
50
- - denis.zablotskii@powerhrg.com
51
49
  executables: []
52
50
  extensions: []
53
51
  extra_rdoc_files: []
@@ -64,6 +62,7 @@ files:
64
62
  - config/routes.rb
65
63
  - lib/tasks/two_percent_tasks.rake
66
64
  - lib/two_percent.rb
65
+ - lib/two_percent/configuration.rb
67
66
  - lib/two_percent/engine.rb
68
67
  - lib/two_percent/version.rb
69
68
  homepage: https://github.com/powerhome/power-tools