masks-server 0.15.0 → 0.16.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 +4 -4
- data/app/graphql/masks/server/manage/types/query_type/activity.rb +124 -0
- data/app/graphql/masks/server/manage/types/query_type/actors.rb +125 -0
- data/app/graphql/masks/server/manage/types/query_type/clients.rb +159 -0
- data/app/graphql/masks/server/manage/types/query_type/directory.rb +54 -0
- data/app/graphql/masks/server/manage/types/query_type/messaging.rb +51 -0
- data/app/graphql/masks/server/manage/types/query_type/organizations.rb +47 -0
- data/app/graphql/masks/server/manage/types/query_type/providers.rb +68 -0
- data/app/graphql/masks/server/manage/types/query_type/status.rb +40 -0
- data/app/graphql/masks/server/manage/types/query_type.rb +11 -539
- data/app/jobs/masks/server/application_job.rb +2 -2
- data/app/jobs/masks/server/backchannel_logout_job.rb +1 -1
- data/app/jobs/masks/server/cleanup_job.rb +1 -1
- data/app/jobs/masks/server/event_stream_job.rb +1 -1
- data/app/jobs/masks/server/saml_logout_job.rb +1 -1
- data/app/jobs/masks/server/signal_job.rb +1 -1
- data/app/jobs/masks/server/text_job.rb +1 -1
- data/app/ldap/masks/server/ldap/connection.rb +1 -1
- data/app/ldap/masks/server/ldap/gate.rb +1 -1
- data/app/{models → logins}/masks/server/login.rb +1 -1
- data/app/logins/masks/server/login_states/{enrolment.rb → protection.rb} +25 -25
- data/app/models/masks/server/actor/claims.rb +95 -0
- data/app/models/masks/server/actor/notices.rb +21 -0
- data/app/models/masks/server/actor/password.rb +85 -0
- data/app/models/masks/server/actor/second_factors.rb +121 -0
- data/app/models/masks/server/actor/suspension.rb +77 -0
- data/app/models/masks/server/actor.rb +5 -332
- data/app/models/masks/server/client/approval.rb +91 -0
- data/app/models/masks/server/client/credentials.rb +104 -0
- data/app/models/masks/server/client/forward_auth.rb +56 -0
- data/app/models/masks/server/client/redirects.rb +135 -0
- data/app/models/masks/server/client/registration.rb +180 -0
- data/app/models/masks/server/client/saml_application.rb +53 -0
- data/app/models/masks/server/client.rb +18 -537
- data/app/models/masks/server/declared.rb +1 -1
- data/app/models/masks/server/issuer.rb +1 -1
- data/app/models/masks/server/locked_out.rb +1 -1
- data/app/models/masks/server/master_key.rb +2 -2
- data/app/models/masks/server/passkey.rb +6 -10
- data/app/models/masks/server/tenant.rb +5 -133
- data/app/{models → saml}/masks/server/saml_identity/metadata.rb +1 -1
- data/app/views/masks/server/account/_signing_in.html.erb +4 -4
- data/app/views/masks/server/logins/{_enrol.html.erb → _protect.html.erb} +19 -19
- data/app/views/masks/server/logins/{_enrol_code_form.html.erb → _protect_code_form.html.erb} +1 -1
- data/config/locales/de/logins.yml +1 -1
- data/config/locales/en/flashes.yml +1 -1
- data/config/locales/en/logins.yml +1 -1
- data/config/locales/es/logins.yml +1 -1
- data/config/locales/fr/logins.yml +1 -1
- data/config/recurring.yml +49 -0
- data/db/migrate/20260912000000_create_masks_schema.rb +1 -1
- data/db/migrate/20260913000000_create_adapters.rb +1 -1
- data/db/migrate/20260913010000_create_sign_in_policies.rb +1 -1
- data/db/migrate/20260913090000_create_delegations.rb +1 -1
- data/db/migrate/20260921000000_create_client_logos.rb +1 -1
- data/db/migrate/20260926020000_create_event_streams.rb +1 -1
- data/db/migrate/20260927020000_create_organizations.rb +1 -1
- data/db/migrate/20260927050000_create_domain_claims.rb +1 -1
- data/db/migrate/20260927110000_create_signal_streams.rb +1 -1
- data/db/migrate/20260927160000_add_invited_at_to_memberships.rb +1 -1
- data/db/migrate/20260927170000_grant_identities_to_actors_in_every_tenant.rb +1 -1
- data/db/migrate/20260927180000_move_directory_ids_to_memberships.rb +1 -1
- data/db/migrate/20261003130000_create_mail_templates.rb +1 -1
- data/db/migrate/20261010120000_add_root_to_tokens.rb +1 -1
- data/db/migrate/20261010140000_create_groups.rb +1 -1
- data/db/migrate/20261010160000_create_tenant_logos.rb +1 -1
- data/db/migrate/20261011170000_create_saml_participations.rb +1 -1
- data/db/migrate/20261011180000_rename_adapters_to_senders.rb +1 -1
- data/db/migrate/20261012100000_create_replays.rb +1 -1
- data/db/migrate/20261018100000_create_released_nicknames.rb +1 -1
- data/db/migrate/20261020100000_create_access_requests.rb +1 -1
- data/db/migrate/20261020140000_create_health_checks.rb +1 -1
- data/lib/generators/masks/server/install/install_generator.rb +21 -1
- data/lib/generators/masks/server/install/templates/recurring.yml.tt +10 -0
- data/lib/masks/server/database_grants.rb +47 -0
- data/lib/masks/server/engine.rb +5 -1
- data/lib/masks/server/recurring.rb +35 -0
- data/lib/masks/server/tenancy/job.rb +2 -2
- data/lib/masks/server/tenancy/middleware.rb +1 -1
- data/lib/masks/server/tenancy/migration.rb +34 -0
- data/lib/masks/server/tenancy.rb +166 -0
- data/lib/masks/server/well_known.rb +43 -0
- data/lib/masks/server.rb +6 -2
- data/lib/tasks/masks.rake +12 -0
- data/public/masks-assets/.vite/manifest.json +13 -13
- data/public/masks-assets/assets/account-zkggUuBn.js +2 -0
- data/public/masks-assets/assets/account-zkggUuBn.js.map +1 -0
- data/public/masks-assets/assets/app-gxHYFYe-.css +2 -0
- data/public/masks-assets/assets/{handshake-YQpRNMIs.js → handshake-CkbNi2-b.js} +1 -1
- data/public/masks-assets/assets/{handshake-YQpRNMIs.js.map → handshake-CkbNi2-b.js.map} +1 -1
- data/public/masks-assets/assets/initial-VBUM-c9X.js +3 -0
- data/public/masks-assets/assets/initial-VBUM-c9X.js.map +1 -0
- data/public/masks-assets/assets/login-DD3NrC2J.js +6 -0
- data/public/masks-assets/assets/login-DD3NrC2J.js.map +1 -0
- data/public/masks-assets/assets/manage-BP1Ys9S1.js +605 -0
- data/public/masks-assets/assets/manage-BP1Ys9S1.js.map +1 -0
- data/public/masks-assets/assets/{passkey-5UYPVD3c.js → passkey-363JNndi.js} +2 -2
- data/public/masks-assets/assets/passkey-363JNndi.js.map +1 -0
- data/version.txt +1 -1
- metadata +78 -53
- data/lib/masks/server/tenant_isolation.rb +0 -52
- data/public/masks-assets/assets/account-h7I6VUPR.js +0 -2
- data/public/masks-assets/assets/account-h7I6VUPR.js.map +0 -1
- data/public/masks-assets/assets/app-CjR8LdGZ.css +0 -2
- data/public/masks-assets/assets/initial-Cn-UuAsy.js +0 -3
- data/public/masks-assets/assets/initial-Cn-UuAsy.js.map +0 -1
- data/public/masks-assets/assets/login-BDggujiZ.js +0 -6
- data/public/masks-assets/assets/login-BDggujiZ.js.map +0 -1
- data/public/masks-assets/assets/manage-DbLHfFvt.js +0 -605
- data/public/masks-assets/assets/manage-DbLHfFvt.js.map +0 -1
- data/public/masks-assets/assets/passkey-5UYPVD3c.js.map +0 -1
- /data/app/{models → federation}/masks/server/federation/mcp.rb +0 -0
- /data/app/{models → federation}/masks/server/federation/oauth2.rb +0 -0
- /data/app/{models → federation}/masks/server/federation/oidc.rb +0 -0
- /data/app/{models → federation}/masks/server/federation/protocol.rb +0 -0
- /data/app/{models → federation}/masks/server/federation/saml.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity/farewells.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity/logout_reply.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity/logout_request.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity/message.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity/request.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity/response.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity/sign_off.rb +0 -0
- /data/app/{models → saml}/masks/server/saml_identity.rb +0 -0
- /data/app/{models → scim}/masks/server/scim/directory.rb +0 -0
- /data/app/{models → scim}/masks/server/scim/filter.rb +0 -0
- /data/app/{models → scim}/masks/server/scim/group.rb +0 -0
- /data/app/{models → scim}/masks/server/scim/organization_directory.rb +0 -0
- /data/app/{models → scim}/masks/server/scim/user.rb +0 -0
- /data/app/{models → scim}/masks/server/scim.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/click_send.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/infobip.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/mail.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/message_bird.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/plivo.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/sinch.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/sms.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/sms_log.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/smtp.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/sns.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/telnyx.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/twilio.rb +0 -0
- /data/app/{models → senders}/masks/server/senders/vonage.rb +0 -0
|
@@ -46,9 +46,15 @@ module Masks
|
|
|
46
46
|
subject_type sector_identifier_uri dpop_bound_access_tokens grant_types response_types
|
|
47
47
|
authorization_details_types
|
|
48
48
|
].freeze
|
|
49
|
+
CONSOLE_ID = "masks-manage".freeze
|
|
50
|
+
CONSOLE_SCOPES = [ Scopes::OPENID, Scopes::PROFILE, Scopes::EMAIL, Scopes::MANAGE, *ManageRoles::SCOPES ].uniq.freeze
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
include Registration
|
|
53
|
+
include Credentials
|
|
54
|
+
include Redirects
|
|
55
|
+
include Approval
|
|
56
|
+
include SamlApplication
|
|
57
|
+
include ForwardAuth
|
|
52
58
|
|
|
53
59
|
has_many :tokens, dependent: :destroy
|
|
54
60
|
has_many :consents, dependent: :destroy
|
|
@@ -60,28 +66,20 @@ module Masks
|
|
|
60
66
|
dependent: :nullify
|
|
61
67
|
has_one :logo, class_name: "ClientLogo", dependent: :delete
|
|
62
68
|
|
|
69
|
+
belongs_to :approved_by, class_name: "Actor", optional: true
|
|
70
|
+
belongs_to :enrolled_by, class_name: "Client", optional: true, inverse_of: :enrolled
|
|
71
|
+
belongs_to :sign_in_policy, optional: true
|
|
72
|
+
|
|
63
73
|
validate :allowed_groups_are_named
|
|
64
74
|
validates :client_id, presence: true, uniqueness: { scope: :tenant_id }
|
|
65
75
|
validates :name, presence: true
|
|
66
76
|
validates :token_endpoint_auth_method, inclusion: { in: AUTH_METHODS }
|
|
67
77
|
validates :protocol, inclusion: { in: [ OIDC, SamlIdentity::PROTOCOL, FORWARD ] }
|
|
68
|
-
validates :saml_entity_id, uniqueness: { scope: :tenant_id }, allow_nil: true
|
|
69
78
|
validates :subject_type, inclusion: { in: Subjects::TYPES }
|
|
70
|
-
validate :redirect_uris_are_usable
|
|
71
|
-
validate :post_logout_redirect_uris_are_usable
|
|
72
79
|
validate :grant_types_are_known
|
|
73
|
-
validate :client_credentials_are_confidential
|
|
74
|
-
validate :keys_are_usable
|
|
75
|
-
validate :saml_is_described, if: :saml?
|
|
76
|
-
validate :forward_is_described, if: :forward?
|
|
77
|
-
validate :forward_auth_rules_are_usable
|
|
78
|
-
validate :backchannel_logout_uri_is_usable
|
|
79
80
|
validate :sector_is_derivable
|
|
80
|
-
validate :consent_is_skipped_only_when_approved
|
|
81
81
|
validate :sector_identifier_uri_is_owned, if: :sector_declared?
|
|
82
|
-
validate :metadata_uris_are_usable
|
|
83
82
|
validate :authorization_details_are_declared
|
|
84
|
-
validate :resources_are_named_only_when_approved
|
|
85
83
|
validates :access_token_lifetime, numericality: { only_integer: true, in: 60..1.day.to_i }, allow_nil: true
|
|
86
84
|
validates :refresh_token_lifetime, numericality: { only_integer: true, in: 5.minutes.to_i..400.days.to_i }, allow_nil: true
|
|
87
85
|
validates :refresh_token_absolute_lifetime, numericality: { only_integer: true, in: 5.minutes.to_i..400.days.to_i },
|
|
@@ -90,253 +88,16 @@ module Masks
|
|
|
90
88
|
less_than_or_equal_to: Consent::LONGEST.to_i }, allow_nil: true
|
|
91
89
|
|
|
92
90
|
normalizes :allowed_groups, with: ->(value) { Array(value).map { |group| group.to_s.strip.downcase }.compact_blank.uniq.sort }
|
|
93
|
-
normalizes :saml_entity_id, :saml_slo_url, with: ->(value) { value.to_s.strip.presence }
|
|
94
|
-
normalizes :forward_auth_rules, with: ->(value) { ForwardAuthRules.normalize(value) }
|
|
95
|
-
normalizes(*METADATA_URIS, with: ->(value) { value.to_s.strip.presence })
|
|
96
91
|
|
|
97
92
|
after_commit :refresh_logo!, on: %i[create update], if: :saved_change_to_logo_uri?
|
|
98
93
|
after_update :archived!, if: -> { saved_change_to_archived_at? && archived? }
|
|
99
94
|
|
|
100
|
-
belongs_to :approved_by, class_name: "Actor", optional: true
|
|
101
|
-
belongs_to :enrolled_by, class_name: "Client", optional: true, inverse_of: :enrolled
|
|
102
|
-
belongs_to :sign_in_policy, optional: true
|
|
103
|
-
|
|
104
|
-
CONSOLE_ID = "masks-manage".freeze
|
|
105
|
-
CONSOLE_SCOPES = [ Scopes::OPENID, Scopes::PROFILE, Scopes::EMAIL, Scopes::MANAGE, *ManageRoles::SCOPES ].uniq.freeze
|
|
106
|
-
|
|
107
|
-
scope :approved, -> { where.not(approved_at: nil) }
|
|
108
95
|
scope :speaking, ->(protocol) { active.where(protocol: protocol) }
|
|
109
96
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
class << self
|
|
113
|
-
def loopback?(uri)
|
|
114
|
-
host = uri.host.to_s
|
|
115
|
-
|
|
116
|
-
LOOPBACK.include?(host) || host.end_with?(".localhost")
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def console!(issuer)
|
|
120
|
-
approved_for(issuer.manage_resource) || create!(
|
|
121
|
-
client_id: CONSOLE_ID,
|
|
122
|
-
name: "Manage #{Current.tenant.name}",
|
|
123
|
-
redirect_uris: [ "#{issuer.manage_resource}/callback" ],
|
|
124
|
-
post_logout_redirect_uris: [ issuer.manage_resource ],
|
|
125
|
-
resources: [ issuer.manage_resource ],
|
|
126
|
-
allowed_scopes: Scopes.join(CONSOLE_SCOPES),
|
|
127
|
-
grant_types: %w[authorization_code refresh_token],
|
|
128
|
-
response_types: [ "code" ],
|
|
129
|
-
token_endpoint_auth_method: "none",
|
|
130
|
-
client_uri: issuer.url,
|
|
131
|
-
handshake_return_to: issuer.manage_resource,
|
|
132
|
-
consent_required: false,
|
|
133
|
-
dynamic: false,
|
|
134
|
-
approved_at: Time.current
|
|
135
|
-
)
|
|
136
|
-
rescue ActiveRecord::RecordNotUnique
|
|
137
|
-
find_by!(client_id: CONSOLE_ID)
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def approve!(handshake, actor:)
|
|
141
|
-
client = approved_for(handshake.resource) || new(client_id: SecureRandom.uuid)
|
|
142
|
-
|
|
143
|
-
client.assign_attributes(
|
|
144
|
-
described_by(handshake).merge(approved_at: Time.current, approved_by: actor, archived_at: nil)
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
client.save!
|
|
148
|
-
client
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def described_by(handshake)
|
|
152
|
-
{
|
|
153
|
-
name: handshake.name,
|
|
154
|
-
redirect_uris: handshake.redirect_uris,
|
|
155
|
-
post_logout_redirect_uris: [ handshake.post_logout_redirect_uri ].compact,
|
|
156
|
-
resources: [ handshake.resource ],
|
|
157
|
-
allowed_scopes: Scopes.join(handshake.scopes),
|
|
158
|
-
grant_types: handshake.grant_types,
|
|
159
|
-
response_types: [ "code" ],
|
|
160
|
-
token_endpoint_auth_method: handshake.auth_method,
|
|
161
|
-
backchannel_logout_uri: handshake.backchannel_logout_uri,
|
|
162
|
-
client_uri: handshake.origin,
|
|
163
|
-
handshake_return_to: handshake.return_to,
|
|
164
|
-
dynamic: false
|
|
165
|
-
}
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
def approved_for(resource)
|
|
169
|
-
return nil if resource.blank?
|
|
170
|
-
|
|
171
|
-
active.approved.where(enrolled_by_id: nil).where("resources @> ?", [ resource.to_s ].to_json).first
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
def register!(metadata)
|
|
175
|
-
new(client_id: SecureRandom.uuid, **registered_attributes(metadata, name: "Unnamed client")).issue_credentials!
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
def metadata_attributes(metadata)
|
|
179
|
-
held = metadata.to_h.stringify_keys.compact_blank
|
|
180
|
-
|
|
181
|
-
held.slice(*METADATA_STRINGS)
|
|
182
|
-
.merge(held.slice(*METADATA_LISTS).transform_values { |value| Array(value).map(&:to_s) })
|
|
183
|
-
.merge(held.slice(*METADATA_SCOPES).transform_values { |value| Scopes.list(value) })
|
|
184
|
-
.merge(held.slice(*METADATA_FLAGS).transform_values { |value| ActiveModel::Type::Boolean.new.cast(value) })
|
|
185
|
-
.merge(held.key?("client_name") ? { "name" => held["client_name"] } : {})
|
|
186
|
-
.symbolize_keys
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
def registered_attributes(metadata, name:, auth_method: DEFAULT_AUTH_METHOD)
|
|
190
|
-
held = metadata_attributes(metadata)
|
|
191
|
-
asked = held[:grant_types].presence || [ "authorization_code" ]
|
|
192
|
-
grant_types = (asked & GRANT_TYPES).presence || asked
|
|
193
|
-
|
|
194
|
-
{
|
|
195
|
-
token_endpoint_auth_method: auth_method,
|
|
196
|
-
subject_type: Subjects::PUBLIC,
|
|
197
|
-
application_type: "web"
|
|
198
|
-
}.merge(held).merge(
|
|
199
|
-
name: held[:name] || name,
|
|
200
|
-
grant_types: grant_types,
|
|
201
|
-
response_types: held[:response_types].presence || response_types_for(grant_types),
|
|
202
|
-
allowed_scopes: Scopes.join(declared_scopes(metadata)),
|
|
203
|
-
dynamic: true
|
|
204
|
-
)
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
def enroll!(token, metadata)
|
|
208
|
-
app = token.client
|
|
209
|
-
app&.lock!
|
|
210
|
-
refusal = app&.enrollment_refusal(token.scope_list)
|
|
211
|
-
|
|
212
|
-
raise EnrollmentRefused, refusal || "the app that issued this enrollment token is gone" if app.nil? || refusal
|
|
213
|
-
|
|
214
|
-
held = metadata.to_h.stringify_keys
|
|
215
|
-
|
|
216
|
-
raise EnrollmentRefused, "jwks_uri is not accepted here; register the public keys as jwks" if held["jwks_uri"].present?
|
|
217
|
-
raise EnrollmentRefused, "jwks is required: the machine signs in with its own key" if held["jwks"].blank?
|
|
218
|
-
|
|
219
|
-
new(
|
|
220
|
-
client_id: SecureRandom.uuid,
|
|
221
|
-
name: held["client_name"].to_s.strip.presence || token.held("name") || "A machine",
|
|
222
|
-
jwks: held["jwks"],
|
|
223
|
-
token_endpoint_auth_method: PRIVATE_KEY_JWT,
|
|
224
|
-
grant_types: [ CLIENT_CREDENTIALS ],
|
|
225
|
-
response_types: [],
|
|
226
|
-
dpop_bound_access_tokens: true,
|
|
227
|
-
resources: app.resources,
|
|
228
|
-
allowed_scopes: Scopes.join(token.scope_list),
|
|
229
|
-
application_type: "native",
|
|
230
|
-
subject_type: Subjects::PUBLIC,
|
|
231
|
-
enrolled_by: app,
|
|
232
|
-
access_token_lifetime: MACHINE_ACCESS_LIFETIME.to_i,
|
|
233
|
-
approved_at: Time.current,
|
|
234
|
-
dynamic: false
|
|
235
|
-
).issue_credentials!
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def declared_scopes(metadata)
|
|
239
|
-
declared = metadata.to_h.stringify_keys["scope"]
|
|
240
|
-
|
|
241
|
-
Scopes.list(declared).empty? ? [] : bounded(declared)
|
|
242
|
-
end
|
|
243
|
-
|
|
244
|
-
def bounded(requested)
|
|
245
|
-
reserved = Scopes.reserved(requested) + Scopes.list(requested).select { |s| Scopes.prefix?(s) }
|
|
246
|
-
|
|
247
|
-
if reserved.any?
|
|
248
|
-
raise ScopesUnavailable,
|
|
249
|
-
"#{Scopes.join(reserved.uniq)} may only be granted to an approved client"
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
ceiling = Current.tenant&.dynamic_client_ceiling
|
|
253
|
-
bounded = ceiling ? Scopes.granted(requested, ceiling) : Scopes.list(requested)
|
|
254
|
-
|
|
255
|
-
if bounded.empty?
|
|
256
|
-
raise ScopesUnavailable,
|
|
257
|
-
"a dynamically registered client may not request #{Scopes.join(requested)}"
|
|
258
|
-
end
|
|
97
|
+
def self.authenticating(client_id, protocol: OIDC)
|
|
98
|
+
return ClientMetadataDocument.resolve(client_id.to_s) if protocol == OIDC && ClientMetadataDocument.url?(client_id)
|
|
259
99
|
|
|
260
|
-
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
def response_types_for(grant_types)
|
|
264
|
-
(Array(grant_types) & REDIRECTED_GRANT_TYPES).any? ? [ "code" ] : []
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
def authenticating(client_id, protocol: OIDC)
|
|
268
|
-
return ClientMetadataDocument.resolve(client_id.to_s) if protocol == OIDC && ClientMetadataDocument.url?(client_id)
|
|
269
|
-
|
|
270
|
-
speaking(protocol).find_by(client_id: client_id.to_s)
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
def forwarding_to(uri)
|
|
274
|
-
origin = Forwarded.origin(uri)
|
|
275
|
-
return nil if origin.nil?
|
|
276
|
-
|
|
277
|
-
speaking(FORWARD).approved.where("redirect_uris @> ?", [ "#{origin}#{FORWARD_CALLBACK}" ].to_json).first
|
|
278
|
-
end
|
|
279
|
-
|
|
280
|
-
def saml_for(entity_id)
|
|
281
|
-
speaking(SamlIdentity::PROTOCOL).find_by(saml_entity_id: entity_id.to_s)
|
|
282
|
-
end
|
|
283
|
-
|
|
284
|
-
def by_registration_token(token)
|
|
285
|
-
return nil if token.blank?
|
|
286
|
-
|
|
287
|
-
active.find_by(registration_token_digest: Digest::SHA256.hexdigest(token.to_s))
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
def enrollment_refusal(scopes)
|
|
292
|
-
return "an archived client enrolls nothing" if archived?
|
|
293
|
-
return "a public client enrolls nothing" if public?
|
|
294
|
-
return "only an approved client enrolls machines" unless approved?
|
|
295
|
-
return "a client enrolls machines only after it claims a namespace" if namespaces.empty?
|
|
296
|
-
return "a scope is required" if Scopes.list(scopes).empty?
|
|
297
|
-
|
|
298
|
-
held = namespaces.map(&:name)
|
|
299
|
-
outside = Scopes.list(scopes).select do |scope|
|
|
300
|
-
Scopes.prefix?(scope) || scope.start_with?(Scopes::NAMESPACE) || !Scopes.covered?(held, scope)
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
"#{Scopes.join(outside)} is outside #{Scopes.join(held)}" if outside.any?
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
def enrolled?
|
|
307
|
-
enrolled_by_id.present?
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
def unenroll!
|
|
311
|
-
transaction do
|
|
312
|
-
revoked = end_tokens!
|
|
313
|
-
update!(archived_at: Time.current) unless archived?
|
|
314
|
-
revoked
|
|
315
|
-
end
|
|
316
|
-
end
|
|
317
|
-
|
|
318
|
-
def end_tokens!
|
|
319
|
-
now = Time.current
|
|
320
|
-
tokens.where(consumed_at: nil).update_all(consumed_at: now, updated_at: now)
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
def public?
|
|
324
|
-
token_endpoint_auth_method == "none"
|
|
325
|
-
end
|
|
326
|
-
|
|
327
|
-
def approved_as?(handshake)
|
|
328
|
-
described = self.class.described_by(handshake)
|
|
329
|
-
candidate = self.class.new(described)
|
|
330
|
-
|
|
331
|
-
described.keys.all? { |key| public_send(key) == candidate.public_send(key) }
|
|
332
|
-
end
|
|
333
|
-
|
|
334
|
-
def asserts?
|
|
335
|
-
token_endpoint_auth_method == PRIVATE_KEY_JWT
|
|
336
|
-
end
|
|
337
|
-
|
|
338
|
-
def secret?
|
|
339
|
-
SECRET_AUTH_METHODS.include?(token_endpoint_auth_method)
|
|
100
|
+
speaking(protocol).find_by(client_id: client_id.to_s)
|
|
340
101
|
end
|
|
341
102
|
|
|
342
103
|
def pairwise?
|
|
@@ -349,14 +110,6 @@ module Masks
|
|
|
349
110
|
redirect_hosts.one? ? redirect_hosts.first : nil
|
|
350
111
|
end
|
|
351
112
|
|
|
352
|
-
def redirect_hosts
|
|
353
|
-
redirect_uris.filter_map { |value| SectorIdentifier.host(value) }.uniq
|
|
354
|
-
end
|
|
355
|
-
|
|
356
|
-
def approved?
|
|
357
|
-
approved_at.present?
|
|
358
|
-
end
|
|
359
|
-
|
|
360
113
|
def document?
|
|
361
114
|
metadata_expires_at.present?
|
|
362
115
|
end
|
|
@@ -375,94 +128,18 @@ module Masks
|
|
|
375
128
|
"#{Current.origin}#{Engine.routes.url_helpers.client_logo_path(client_id, v: logo_digest, size: size)}"
|
|
376
129
|
end
|
|
377
130
|
|
|
378
|
-
def link(field)
|
|
379
|
-
value = public_send(field)
|
|
380
|
-
|
|
381
|
-
value if LINKS.include?(field) && value.present? && web_uri_refusal(value).nil?
|
|
382
|
-
end
|
|
383
|
-
|
|
384
131
|
def refresh_logo!
|
|
385
132
|
ClientLogoJob.perform_later(id)
|
|
386
133
|
end
|
|
387
134
|
|
|
388
|
-
def issue_credentials!
|
|
389
|
-
issue_secret! if secret?
|
|
390
|
-
issue_registration_token!
|
|
391
|
-
save!
|
|
392
|
-
self
|
|
393
|
-
end
|
|
394
|
-
|
|
395
|
-
def issue_secret!
|
|
396
|
-
@secret = SecureRandom.urlsafe_base64(48)
|
|
397
|
-
self.secret_digest = BCrypt::Password.create(@secret)
|
|
398
|
-
@secret
|
|
399
|
-
end
|
|
400
|
-
|
|
401
|
-
def issue_registration_token!
|
|
402
|
-
@registration_token = SecureRandom.urlsafe_base64(48)
|
|
403
|
-
self.registration_token_digest = Digest::SHA256.hexdigest(@registration_token)
|
|
404
|
-
@registration_token
|
|
405
|
-
end
|
|
406
|
-
|
|
407
|
-
def authenticate_secret(candidate)
|
|
408
|
-
return true if public?
|
|
409
|
-
|
|
410
|
-
secret_matches?(candidate) && !secret_expired?
|
|
411
|
-
end
|
|
412
|
-
|
|
413
|
-
def secret_matches?(candidate)
|
|
414
|
-
return false unless secret?
|
|
415
|
-
return false if secret_digest.blank? || candidate.blank?
|
|
416
|
-
|
|
417
|
-
BCrypt::Password.new(secret_digest) == candidate.to_s
|
|
418
|
-
rescue BCrypt::Errors::InvalidHash
|
|
419
|
-
false
|
|
420
|
-
end
|
|
421
|
-
|
|
422
|
-
def secret_expired?
|
|
423
|
-
secret_expires_at.present? && secret_expires_at.past?
|
|
424
|
-
end
|
|
425
|
-
|
|
426
|
-
def redirect_uri?(candidate)
|
|
427
|
-
redirect_uris.include?(candidate.to_s) || redirect_uris.any? { |registered| same_loopback?(registered, candidate.to_s) }
|
|
428
|
-
end
|
|
429
|
-
|
|
430
135
|
def grants?(grant_type)
|
|
431
136
|
grant_types.include?(grant_type.to_s)
|
|
432
137
|
end
|
|
433
138
|
|
|
434
|
-
def redirects?
|
|
435
|
-
saml? || (grant_types & REDIRECTED_GRANT_TYPES).any?
|
|
436
|
-
end
|
|
437
|
-
|
|
438
|
-
def saml?
|
|
439
|
-
protocol == SamlIdentity::PROTOCOL
|
|
440
|
-
end
|
|
441
|
-
|
|
442
|
-
def forward?
|
|
443
|
-
protocol == FORWARD
|
|
444
|
-
end
|
|
445
|
-
|
|
446
|
-
def forward_origin
|
|
447
|
-
Forwarded.origin(redirect_uris.first) if forward?
|
|
448
|
-
end
|
|
449
|
-
|
|
450
|
-
def keys?
|
|
451
|
-
jwks.present? || jwks_uri.present?
|
|
452
|
-
end
|
|
453
|
-
|
|
454
139
|
def default_response_types
|
|
455
140
|
self.class.response_types_for(grant_types)
|
|
456
141
|
end
|
|
457
142
|
|
|
458
|
-
def saml_x509_certificate
|
|
459
|
-
return nil if saml_certificate.blank?
|
|
460
|
-
|
|
461
|
-
OpenSSL::X509::Certificate.new(OneLogin::RubySaml::Utils.format_cert(saml_certificate.to_s.strip))
|
|
462
|
-
rescue OpenSSL::X509::CertificateError
|
|
463
|
-
nil
|
|
464
|
-
end
|
|
465
|
-
|
|
466
143
|
def unattended_scopes
|
|
467
144
|
Scopes.unattended(scope_list)
|
|
468
145
|
end
|
|
@@ -471,10 +148,6 @@ module Masks
|
|
|
471
148
|
Scopes.union(required_scopes, offered_scopes)
|
|
472
149
|
end
|
|
473
150
|
|
|
474
|
-
def follows_registration?
|
|
475
|
-
dynamic? && Scopes.list(allowed_scopes).empty?
|
|
476
|
-
end
|
|
477
|
-
|
|
478
151
|
def access_lifetime
|
|
479
152
|
access_token_lifetime&.seconds || AccessToken.lifetime
|
|
480
153
|
end
|
|
@@ -491,10 +164,6 @@ module Masks
|
|
|
491
164
|
allowed_groups.empty? || actor.group_labels.intersect?(allowed_groups)
|
|
492
165
|
end
|
|
493
166
|
|
|
494
|
-
def forward_rules
|
|
495
|
-
ForwardAuthRules.new(forward_auth_rules)
|
|
496
|
-
end
|
|
497
|
-
|
|
498
167
|
def permitted_scopes(requested)
|
|
499
168
|
return scope_list if Scopes.list(requested).empty?
|
|
500
169
|
|
|
@@ -513,38 +182,9 @@ module Masks
|
|
|
513
182
|
Current.tenant&.dynamic_client_ceiling || DEFAULT_SCOPES
|
|
514
183
|
end
|
|
515
184
|
|
|
516
|
-
def
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
"client_id" => client_id,
|
|
520
|
-
"client_name" => name,
|
|
521
|
-
"redirect_uris" => redirect_uris,
|
|
522
|
-
"post_logout_redirect_uris" => post_logout_redirect_uris.presence,
|
|
523
|
-
"grant_types" => grant_types,
|
|
524
|
-
"response_types" => response_types,
|
|
525
|
-
"scope" => Scopes.join(scope_list),
|
|
526
|
-
"token_endpoint_auth_method" => token_endpoint_auth_method,
|
|
527
|
-
"subject_type" => subject_type,
|
|
528
|
-
"dpop_bound_access_tokens" => dpop_bound_access_tokens,
|
|
529
|
-
"sector_identifier_uri" => sector_identifier_uri,
|
|
530
|
-
"application_type" => application_type,
|
|
531
|
-
"client_uri" => client_uri,
|
|
532
|
-
"logo_uri" => logo_uri,
|
|
533
|
-
"tos_uri" => tos_uri,
|
|
534
|
-
"policy_uri" => policy_uri,
|
|
535
|
-
"backchannel_logout_uri" => backchannel_logout_uri,
|
|
536
|
-
"backchannel_logout_session_required" => backchannel_logout_session_required,
|
|
537
|
-
"require_pushed_authorization_requests" => require_pushed_authorization_requests,
|
|
538
|
-
"require_signed_request_object" => require_signed_request_object,
|
|
539
|
-
"jwks" => jwks.presence,
|
|
540
|
-
"jwks_uri" => jwks_uri.presence,
|
|
541
|
-
"authorization_details_types" => authorization_details_types.presence,
|
|
542
|
-
"client_id_issued_at" => created_at&.to_i
|
|
543
|
-
}.compact
|
|
544
|
-
end
|
|
545
|
-
|
|
546
|
-
def notified_on_logout?
|
|
547
|
-
backchannel_logout_uri.present?
|
|
185
|
+
def end_tokens!
|
|
186
|
+
now = Time.current
|
|
187
|
+
tokens.where(consumed_at: nil).update_all(consumed_at: now, updated_at: now)
|
|
548
188
|
end
|
|
549
189
|
|
|
550
190
|
private
|
|
@@ -566,52 +206,6 @@ module Masks
|
|
|
566
206
|
errors.add(:allowed_groups, "names #{unknown.join(', ')}, which is not a group key or key:role") if unknown.any?
|
|
567
207
|
end
|
|
568
208
|
|
|
569
|
-
def consent_is_skipped_only_when_approved
|
|
570
|
-
return if consent_required? || approved?
|
|
571
|
-
|
|
572
|
-
errors.add(:consent_required, "may only be switched off for an approved client")
|
|
573
|
-
end
|
|
574
|
-
|
|
575
|
-
def backchannel_logout_uri_is_usable
|
|
576
|
-
return if backchannel_logout_uri.blank?
|
|
577
|
-
|
|
578
|
-
refusal = web_uri_refusal(backchannel_logout_uri.to_s, fetched: true)
|
|
579
|
-
errors.add(:backchannel_logout_uri, refusal) if refusal
|
|
580
|
-
end
|
|
581
|
-
|
|
582
|
-
def redirect_uris_are_usable
|
|
583
|
-
if redirect_uris.blank?
|
|
584
|
-
errors.add(:redirect_uris, "must include at least one URI") if redirects?
|
|
585
|
-
return
|
|
586
|
-
end
|
|
587
|
-
|
|
588
|
-
redirect_uris.each { |value| redirect_refusal(:redirect_uris, value) }
|
|
589
|
-
end
|
|
590
|
-
|
|
591
|
-
def post_logout_redirect_uris_are_usable
|
|
592
|
-
Array(post_logout_redirect_uris).each { |value| redirect_refusal(:post_logout_redirect_uris, value) }
|
|
593
|
-
end
|
|
594
|
-
|
|
595
|
-
def redirect_refusal(attribute, value)
|
|
596
|
-
uri = URI.parse(value.to_s)
|
|
597
|
-
|
|
598
|
-
if uri.fragment.present?
|
|
599
|
-
errors.add(attribute, "must not contain a fragment: #{value}")
|
|
600
|
-
elsif uri.scheme.blank?
|
|
601
|
-
errors.add(attribute, "must be absolute: #{value}")
|
|
602
|
-
elsif SCRIPTED_SCHEMES.include?(uri.scheme.downcase)
|
|
603
|
-
errors.add(attribute, "must not use the #{uri.scheme.downcase} scheme: #{value}")
|
|
604
|
-
elsif uri.scheme.casecmp?("http") && !loopback?(uri) && !::Rails.env.local?
|
|
605
|
-
errors.add(attribute, "must use https unless it is loopback: #{value}")
|
|
606
|
-
end
|
|
607
|
-
rescue URI::InvalidURIError
|
|
608
|
-
errors.add(attribute, "is not a URI: #{value}")
|
|
609
|
-
end
|
|
610
|
-
|
|
611
|
-
def loopback?(uri)
|
|
612
|
-
self.class.loopback?(uri)
|
|
613
|
-
end
|
|
614
|
-
|
|
615
209
|
def open_to_anything?
|
|
616
210
|
follows_registration? && Current.tenant&.dynamic_registration == Tenant::REGISTRATION_ANYTHING
|
|
617
211
|
end
|
|
@@ -620,129 +214,16 @@ module Masks
|
|
|
620
214
|
Scopes.list(requested).reject { |scope| Scopes.prefix?(scope) || Scopes.reserved(scope).any? }
|
|
621
215
|
end
|
|
622
216
|
|
|
623
|
-
def same_loopback?(registered, candidate)
|
|
624
|
-
held = URI.parse(registered)
|
|
625
|
-
asked = URI.parse(candidate)
|
|
626
|
-
|
|
627
|
-
[ held, asked ].all? { |uri| uri.instance_of?(URI::HTTP) && LOOPBACK.include?(uri.hostname) && uri.userinfo.nil? && uri.fragment.nil? } &&
|
|
628
|
-
held.hostname == asked.hostname && held.path == asked.path && held.query == asked.query
|
|
629
|
-
rescue URI::InvalidURIError
|
|
630
|
-
false
|
|
631
|
-
end
|
|
632
|
-
|
|
633
217
|
def grant_types_are_known
|
|
634
218
|
unknown = grant_types - GRANT_TYPES
|
|
635
219
|
errors.add(:grant_types, "not supported: #{unknown.join(', ')}") if unknown.any?
|
|
636
220
|
end
|
|
637
221
|
|
|
638
|
-
def forward_auth_rules_are_usable
|
|
639
|
-
held = forward_auth_rules
|
|
640
|
-
|
|
641
|
-
return errors.add(:base, "forward auth rules apply only to an app behind a proxy") if held.present? && !forward?
|
|
642
|
-
|
|
643
|
-
ForwardAuthRules.problems(held).each { |problem| errors.add(:base, problem) }
|
|
644
|
-
end
|
|
645
|
-
|
|
646
|
-
def forward_is_described
|
|
647
|
-
errors.add(:grant_types, "are not used by an app behind a proxy") if grant_types.any?
|
|
648
|
-
errors.add(:token_endpoint_auth_method, "is none for an app behind a proxy") unless public?
|
|
649
|
-
|
|
650
|
-
unless redirect_uris.one? && redirect_uris.first.to_s.end_with?(FORWARD_CALLBACK) && forward_origin
|
|
651
|
-
errors.add(:redirect_uris, "hold the app's own #{FORWARD_CALLBACK}, and nothing else")
|
|
652
|
-
end
|
|
653
|
-
end
|
|
654
|
-
|
|
655
|
-
def saml_is_described
|
|
656
|
-
errors.add(:saml_entity_id, "is required for a SAML application") if saml_entity_id.blank?
|
|
657
|
-
errors.add(:grant_types, "are not used by a SAML application") if grant_types.any?
|
|
658
|
-
errors.add(:token_endpoint_auth_method, "is none for a SAML application") unless public?
|
|
659
|
-
errors.add(:saml_certificate, "is not a certificate masks can read") if saml_certificate.present? && saml_x509_certificate.nil?
|
|
660
|
-
errors.add(:saml_certificate, "is required to check signed requests") if saml_requests_signed? && saml_certificate.blank?
|
|
661
|
-
saml_slo_url&.then { |url| web_uri_refusal(url, fetched: true) }&.then { |refusal| errors.add(:saml_slo_url, refusal) }
|
|
662
|
-
|
|
663
|
-
if saml_name_id_format.present? && !SamlIdentity::NAME_ID_FORMATS.include?(saml_name_id_format)
|
|
664
|
-
errors.add(:saml_name_id_format, "is not one masks issues")
|
|
665
|
-
end
|
|
666
|
-
|
|
667
|
-
unless saml_attributes.is_a?(Hash) && saml_attributes.all? { |name, claim| name.to_s.match?(/\A[\w:.\/-]{1,256}\z/) && claim.is_a?(String) }
|
|
668
|
-
errors.add(:saml_attributes, "map attribute names to claim names")
|
|
669
|
-
end
|
|
670
|
-
end
|
|
671
|
-
|
|
672
|
-
def client_credentials_are_confidential
|
|
673
|
-
return unless grants?(CLIENT_CREDENTIALS)
|
|
674
|
-
|
|
675
|
-
errors.add(:grant_types, "client_credentials needs a client that authenticates, not a public one") if public?
|
|
676
|
-
errors.add(:grant_types, "client_credentials may only be granted to an approved client") unless approved?
|
|
677
|
-
end
|
|
678
|
-
|
|
679
|
-
def keys_are_usable
|
|
680
|
-
errors.add(:jwks, "and jwks_uri cannot both be registered") if jwks.present? && jwks_uri.present?
|
|
681
|
-
|
|
682
|
-
if require_signed_request_object? && !keys?
|
|
683
|
-
errors.add(:require_signed_request_object, "needs jwks or a jwks_uri to check request objects against")
|
|
684
|
-
end
|
|
685
|
-
|
|
686
|
-
if asserts? && !keys?
|
|
687
|
-
errors.add(:token_endpoint_auth_method, "private_key_jwt needs jwks or a jwks_uri to check assertions against")
|
|
688
|
-
end
|
|
689
|
-
|
|
690
|
-
self.jwks = ClientKeys.check!(jwks) if jwks.present? && will_save_change_to_jwks?
|
|
691
|
-
ClientKeys.fetch(jwks_uri) if jwks_uri.present? && will_save_change_to_jwks_uri?
|
|
692
|
-
rescue ClientKeys::Refused => e
|
|
693
|
-
errors.add(jwks_uri.present? && jwks.blank? ? :jwks_uri : :jwks, e.message)
|
|
694
|
-
end
|
|
695
|
-
|
|
696
222
|
def sector_declared?
|
|
697
223
|
sector_identifier_uri.present? &&
|
|
698
224
|
(sector_identifier_uri_changed? || redirect_uris_changed?)
|
|
699
225
|
end
|
|
700
226
|
|
|
701
|
-
def metadata_uris_are_usable
|
|
702
|
-
METADATA_URIS.each do |field|
|
|
703
|
-
value = public_send(field)
|
|
704
|
-
|
|
705
|
-
next if value.blank? || !will_save_change_to_attribute?(field)
|
|
706
|
-
|
|
707
|
-
refusal = web_uri_refusal(value, fetched: field == :logo_uri)
|
|
708
|
-
errors.add(field, refusal) if refusal
|
|
709
|
-
end
|
|
710
|
-
end
|
|
711
|
-
|
|
712
|
-
def web_uri_refusal(value, fetched: false)
|
|
713
|
-
return "must be at most #{URI_LIMIT} characters" if value.length > URI_LIMIT
|
|
714
|
-
|
|
715
|
-
uri = URI.parse(value)
|
|
716
|
-
|
|
717
|
-
if !uri.is_a?(URI::HTTP)
|
|
718
|
-
"must be an http or https URL"
|
|
719
|
-
elsif uri.host.blank?
|
|
720
|
-
"must be absolute"
|
|
721
|
-
elsif uri.userinfo.present?
|
|
722
|
-
"must not carry a username or password"
|
|
723
|
-
elsif fetched && uri.fragment.present?
|
|
724
|
-
"must not contain a fragment"
|
|
725
|
-
elsif fetched && dynamic? && !::Rails.env.local?
|
|
726
|
-
dynamic_fetch_refusal(uri)
|
|
727
|
-
elsif uri.scheme == "http" && !loopback?(uri) && !::Rails.env.local?
|
|
728
|
-
"must use https unless it is loopback"
|
|
729
|
-
end
|
|
730
|
-
rescue URI::InvalidURIError
|
|
731
|
-
"is not a URI"
|
|
732
|
-
end
|
|
733
|
-
|
|
734
|
-
def dynamic_fetch_refusal(uri)
|
|
735
|
-
return "must not point at a loopback address" if loopback?(uri)
|
|
736
|
-
|
|
737
|
-
"must use https" unless uri.scheme == "https"
|
|
738
|
-
end
|
|
739
|
-
|
|
740
|
-
def resources_are_named_only_when_approved
|
|
741
|
-
return unless dynamic? && !approved? && resources.any? && will_save_change_to_resources?
|
|
742
|
-
|
|
743
|
-
errors.add(:resources, "may only be named by an approved client, since tokens for a resource are trusted by it")
|
|
744
|
-
end
|
|
745
|
-
|
|
746
227
|
def authorization_details_are_declared
|
|
747
228
|
types = authorization_details_types
|
|
748
229
|
|
|
@@ -8,7 +8,7 @@ module Masks
|
|
|
8
8
|
subdomain, identifier = named.include?("/") ? named.split("/", 2) : [ nil, named ]
|
|
9
9
|
tenants = subdomain ? Tenant.active.where(subdomain: subdomain) : Tenant.active
|
|
10
10
|
|
|
11
|
-
tenants.filter_map { |tenant|
|
|
11
|
+
tenants.filter_map { |tenant| Tenancy.switch(tenant) { recover_in(tenant, identifier) } }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
private
|