Skip to content

Commit 198ab05

Browse files
Stir shaken crt inheritance (#1710)
* customer auth stir shaken certificate inheritance
1 parent bae8e0d commit 198ab05

File tree

19 files changed

+5141
-16
lines changed

19 files changed

+5141
-16
lines changed

app/admin/equipment/gateways.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ def resource_params
331331
scope: -> { Routing::Numberlist.order(:name) },
332332
path: '/numberlists/search'
333333

334+
filter :stir_shaken_crt, as: :select, input_html: { class: 'chosen' }
335+
334336
form do |f|
335337
f.semantic_errors *f.object.errors.attribute_names
336338

@@ -529,7 +531,7 @@ def resource_params
529531
f.inputs 'STIR/SHAKEN' do
530532
f.input :stir_shaken_mode_id, as: :select, include_blank: false,
531533
collection: Gateway::STIR_SHAKEN_MODES.invert
532-
f.input :stir_shaken_crt, as: :select
534+
f.input :stir_shaken_crt, as: :select, input_html: { class: 'chosen' }
533535
end
534536
end
535537
end

app/admin/import/import_customers_auths.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,6 @@ def resource_params
8989

9090
column :tag_action
9191
column :tag_action_value
92+
column :stir_shaken_crt, &:stir_shaken_crt_name
9293
end
9394
end

app/admin/routing/customers_auths.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
:ss_src_rewrite_rule,
6868
:ss_src_rewrite_result,
6969
:ss_dst_rewrite_rule,
70-
:ss_dst_rewrite_result
70+
:ss_dst_rewrite_result,
71+
[:stir_shaken_crt_name, proc { |row| row.stir_shaken_crt.try(:name) }]
7172

7273
acts_as_import resource_class: Importing::CustomersAuth, skip_columns: [:tag_action_value]
7374

@@ -96,6 +97,7 @@
9697
:cnam_database_id, :src_numberlist_use_diversion, :rewrite_ss_status_id,
9798
:ss_mode_id, :ss_invalid_identity_action_id, :ss_no_identity_action_id,
9899
:ss_src_rewrite_rule, :ss_src_rewrite_result, :ss_dst_rewrite_rule, :ss_dst_rewrite_result,
100+
:stir_shaken_crt_id,
99101
tag_action_value: []
100102
# , :enable_redirect, :redirect_method, :redirect_to
101103

@@ -262,6 +264,8 @@ def update
262264
scope: -> { Routing::Numberlist.order(:name) },
263265
path: '/numberlists/search'
264266

267+
filter :stir_shaken_crt, as: :select, input_html: { class: 'chosen' }
268+
265269
form do |f|
266270
f.semantic_errors *f.object.errors.attribute_names
267271
tabs do
@@ -425,6 +429,7 @@ def update
425429
f.input :ss_src_rewrite_result
426430
f.input :ss_dst_rewrite_rule
427431
f.input :ss_dst_rewrite_result
432+
f.input :stir_shaken_crt, as: :select, input_html: { class: 'chosen' }
428433
end
429434
end
430435
end
@@ -536,6 +541,7 @@ def update
536541
row :ss_src_rewrite_result
537542
row :ss_dst_rewrite_rule
538543
row :ss_dst_rewrite_result
544+
row :stir_shaken_crt
539545
end
540546
end
541547
end

app/models/customers_auth.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
# ss_invalid_identity_action_id :integer(2) default(0), not null
7373
# ss_mode_id :integer(2) default(0), not null
7474
# ss_no_identity_action_id :integer(2) default(0), not null
75+
# stir_shaken_crt_id :integer(2)
7576
# tag_action_id :integer(2)
7677
# transport_protocol_id :integer(2)
7778
#
@@ -244,6 +245,7 @@ module CONST
244245
belongs_to :lua_script, class_name: 'System::LuaScript', foreign_key: :lua_script_id, optional: true
245246

246247
belongs_to :cnam_database, class_name: 'Cnam::Database', foreign_key: :cnam_database_id, optional: true
248+
belongs_to :stir_shaken_crt, class_name: 'Equipment::StirShaken::SigningCertificate', foreign_key: :stir_shaken_crt_id, optional: :true
247249

248250
array_belongs_to :tag_action_values, class_name: 'Routing::RoutingTag', foreign_key: :tag_action_value
249251

app/models/customers_auth_normalized.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
# ss_invalid_identity_action_id :integer(2) default(0), not null
7474
# ss_mode_id :integer(2) default(0), not null
7575
# ss_no_identity_action_id :integer(2) default(0), not null
76+
# stir_shaken_crt_id :integer(2)
7677
# tag_action_id :integer(2)
7778
# transport_protocol_id :integer(2)
7879
#

app/models/equipment/stir_shaken/signing_certificate.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
class Equipment::StirShaken::SigningCertificate < ApplicationRecord
1515
self.table_name = 'class4.stir_shaken_signing_certificates'
1616

17+
has_many :customers_auths, foreign_key: :stir_shaken_crt_id, dependent: :restrict_with_error
18+
has_many :gateways, foreign_key: :stir_shaken_crt_id, dependent: :restrict_with_error
19+
1720
validates :name, :certificate, :key, :x5u, presence: true
1821

1922
include Yeti::StateUpdater

app/models/importing/customers_auth.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
# src_prefix :string
6161
# src_rewrite_result :string
6262
# src_rewrite_rule :string
63+
# stir_shaken_crt_name :string
6364
# tag_action_name :string
6465
# tag_action_value :integer(2) default([]), not null, is an Array
6566
# tag_action_value_names :string
@@ -87,6 +88,7 @@
8788
# src_name_field_id :integer(2)
8889
# src_number_field_id :integer(2)
8990
# src_numberlist_id :integer(4)
91+
# stir_shaken_crt_id :integer(2)
9092
# tag_action_id :integer(2)
9193
# transport_protocol_id :integer(2)
9294
#
@@ -108,6 +110,7 @@ class Importing::CustomersAuth < Importing::Base
108110
belongs_to :radius_accounting_profile, class_name: '::Equipment::Radius::AccountingProfile', foreign_key: :radius_accounting_profile_id, optional: true
109111
belongs_to :tag_action, class_name: 'Routing::TagAction', optional: true
110112
belongs_to :lua_script, class_name: 'System::LuaScript', foreign_key: :lua_script_id, optional: true
113+
belongs_to :stir_shaken_crt, class_name: 'Equipment::StirShaken::SigningCertificate', foreign_key: :stir_shaken_crt_id, optional: :true
111114

112115
self.import_attributes = %w[
113116
enabled
@@ -158,6 +161,7 @@ class Importing::CustomersAuth < Importing::Base
158161
tag_action_id
159162
tag_action_value
160163
lua_script_id
164+
stir_shaken_crt_id
161165
]
162166

163167
import_for ::CustomersAuth

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ en:
109109
radius_accounting_profile: "RADIUS accounting profile for LegA(Origination)"
110110
ss_src_rewrite_rule: 'Rewrite rule to adapt SRC number before STIR/SHAKEN Identity validation'
111111
ss_dst_rewrite_rule: 'Rewrite rule to adapt DST number before STIR/SHAKEN Identity validation'
112+
stir_shaken_crt: 'Redefine certificate for signature. If null - vendor gw certificate will be used'
112113
destination:
113114
reverse_billing: "If enabled, customer account balance is raised"
114115
routing_routing_plan:

0 commit comments

Comments
 (0)