-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate signing keys builder into main flow
Variables values related to signing keys fetching from one side and values validation and the settings object creation are split to two classes (parameters fetcher and settings builder) both classes are used by CreateSigningKeyProvider class
- Loading branch information
Showing
12 changed files
with
297 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...omain/authentication/authn_jwt/signing_key/fetch_signing_key_parameters_from_variables.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module Authentication | ||
module AuthnJwt | ||
module SigningKey | ||
# This class is responsible for fetching values of all variables related | ||
# to signing key settings area | ||
FetchSigningKeyParametersFromVariables ||= CommandClass.new( | ||
dependencies: { | ||
check_authenticator_secret_exists: Authentication::Util::CheckAuthenticatorSecretExists.new, | ||
fetch_authenticator_secrets: Authentication::Util::FetchAuthenticatorSecrets.new | ||
}, | ||
inputs: %i[authenticator_input] | ||
) do | ||
def call | ||
fetch_variables_values | ||
variables_values | ||
end | ||
|
||
private | ||
|
||
def fetch_variables_values | ||
SIGNING_KEY_RESOURCES_NAMES.each do |name| | ||
variables_values[name] = secret_value(secret_name: name) | ||
end | ||
end | ||
|
||
def variables_values | ||
@variables_values ||= {} | ||
end | ||
|
||
def secret_value(secret_name:) | ||
return nil unless secret_exists?(secret_name: secret_name) | ||
|
||
@fetch_authenticator_secrets.call( | ||
conjur_account: @authenticator_input.account, | ||
authenticator_name: @authenticator_input.authenticator_name, | ||
service_id: @authenticator_input.service_id, | ||
required_variable_names: [secret_name] | ||
)[secret_name] | ||
end | ||
|
||
def secret_exists?(secret_name:) | ||
@check_authenticator_secret_exists.call( | ||
conjur_account: @authenticator_input.account, | ||
authenticator_name: @authenticator_input.authenticator_name, | ||
service_id: @authenticator_input.service_id, | ||
var_name: secret_name | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
77 changes: 0 additions & 77 deletions
77
app/domain/authentication/authn_jwt/signing_key/fetch_signing_key_settings_from_variables.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.