Skip to content

Commit

Permalink
Merge pull request #29 from nevissecurity/feature/NEVISACCESSAPP-6056-…
Browse files Browse the repository at this point in the history
…renaming

NEVISACCESSAPP-5973: Renamed `whiteList` to `allowList`
  • Loading branch information
viktor-gulyas authored Jul 16, 2024
2 parents e1aba66 + bd8a43d commit a799e78
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions NevisExampleApp/Configuration/Model/AppConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct AppConfiguration: Codable {
let sdkConfiguration: Configuration

/// The allowed authenticators.
let authenticatorWhitelist: [AuthenticatorAaid]
let authenticatorAllowlist: [AuthenticatorAaid]

// MARK: - CodingKey

Expand All @@ -28,8 +28,8 @@ struct AppConfiguration: Codable {
case loginConfiguration = "login"
/// Key for the SDK configuration.
case sdkConfiguration = "sdk"
/// Key for the authenticator whitelist.
case authenticatorWhitelist
/// Key for the authenticator allowlist.
case authenticatorAllowlist

/// Enumeration for the nested SDK configuration keys used during coding.
enum NestedCodingKeys: String, CodingKey {
Expand Down Expand Up @@ -78,6 +78,6 @@ struct AppConfiguration: Codable {
else {
self.sdkConfiguration = try container.decode(Configuration.self, forKey: .sdkConfiguration)
}
self.authenticatorWhitelist = try container.decode([AuthenticatorAaid].self, forKey: .authenticatorWhitelist)
self.authenticatorAllowlist = try container.decode([AuthenticatorAaid].self, forKey: .authenticatorAllowlist)
}
}
2 changes: 1 addition & 1 deletion NevisExampleApp/Interaction/AccountSelectorImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extension AccountSelectorImpl: AccountSelector {
message: transactionConfirmationDataString)
appCoordinator.navigateToAccountSelection(with: parameter)
}
case let .failure(error):
case .failure:
handler.cancel()
}
}
Expand Down
4 changes: 2 additions & 2 deletions NevisExampleApp/Interaction/AuthenticatorSelectorImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ extension AuthenticatorSelectorImpl: AuthenticatorSelector {

let validator = AuthenticatorValidator()
let validationResult = switch operation {
case .registration: validator.validateForRegistration(context: context, whitelistedAuthenticators: configuration.authenticatorWhitelist)
case .authentication: validator.validateForAuthentication(context: context, whitelistedAuthenticators: configuration.authenticatorWhitelist)
case .registration: validator.validateForRegistration(context: context, allowlistedAuthenticators: configuration.authenticatorAllowlist)
case .authentication: validator.validateForAuthentication(context: context, allowlistedAuthenticators: configuration.authenticatorAllowlist)
}

switch validationResult {
Expand Down
2 changes: 1 addition & 1 deletion NevisExampleApp/Resources/ConfigAuthenticationCloud.plist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<key>hostName</key>
<string>myinstance.mauth.nevis.cloud</string>
</dict>
<key>authenticatorWhitelist</key>
<key>authenticatorAllowlist</key>
<array>
<string>F1D0#1001</string>
<string>F1D0#1002</string>
Expand Down
14 changes: 7 additions & 7 deletions NevisExampleApp/Resources/ConfigIdentitySuite.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
<key>userInteractionTimeoutInSeconds</key>
<integer>240</integer>
</dict>
<key>authenticatorWhitelist</key>
<array>
<string>F1D0#1001</string>
<string>F1D0#1002</string>
<string>F1D0#1003</string>
<string>F1D0#1004</string>
</array>
<key>authenticatorAllowlist</key>
<array>
<string>F1D0#1001</string>
<string>F1D0#1002</string>
<string>F1D0#1003</string>
<string>F1D0#1004</string>
</array>
</dict>
</plist>
22 changes: 11 additions & 11 deletions NevisExampleApp/Utility/Validation/AuthenticatorValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extension AuthenticatorValidator {
/// Validates authenticators for registration.
///
/// - Parameter context: The context holding the accounts to validate.
/// - Parameter whitelistedAuthenticators: The array holding the whitelisted authenticators.
/// - Parameter allowlistedAuthenticators: The array holding the allowlisted authenticators.
/// - Returns: The result of the validation
func validateForRegistration(context: AuthenticatorSelectionContext, whitelistedAuthenticators: [AuthenticatorAaid]) -> ValidationResult<[any Authenticator]> {
let allowedAuthenticators = allowedAuthenticators(context: context, whitelistedAuthenticators: whitelistedAuthenticators).filter { authenticator in
func validateForRegistration(context: AuthenticatorSelectionContext, allowlistedAuthenticators: [AuthenticatorAaid]) -> ValidationResult<[any Authenticator]> {
let allowedAuthenticators = allowedAuthenticators(context: context, allowlistedAuthenticators: allowlistedAuthenticators).filter { authenticator in
// Do not display:
// - policy non-compliant authenticators (this includes already registered authenticators)
// - not hardware supported authenticators.
Expand All @@ -35,10 +35,10 @@ extension AuthenticatorValidator {
/// Validates authenticators for authentication.
///
/// - Parameter context: The context holding the accounts to validate.
/// - Parameter whitelistedAuthenticators: The array holding the whitelisted authenticators.
/// - Parameter allowlistedAuthenticators: The array holding the allowlisted authenticators.
/// - Returns: The result of the validation
func validateForAuthentication(context: AuthenticatorSelectionContext, whitelistedAuthenticators: [AuthenticatorAaid]) -> ValidationResult<[any Authenticator]> {
let allowedAuthenticators = allowedAuthenticators(context: context, whitelistedAuthenticators: whitelistedAuthenticators).filter { authenticator in
func validateForAuthentication(context: AuthenticatorSelectionContext, allowlistedAuthenticators: [AuthenticatorAaid]) -> ValidationResult<[any Authenticator]> {
let allowedAuthenticators = allowedAuthenticators(context: context, allowlistedAuthenticators: allowlistedAuthenticators).filter { authenticator in
guard let registration = authenticator.registration else { return false }

// Do not display:
Expand All @@ -55,18 +55,18 @@ extension AuthenticatorValidator {
}
}

// MARK: Filtering based on the authenticator whitelist
// MARK: Filtering based on the authenticator allowlist

private extension AuthenticatorValidator {
/// Filters out non-whitelisted authenticators.
/// Filters out non-allowlisted authenticators.
///
/// - Parameter context: The context holding the accounts to validate.
/// - Parameter whitelistedAuthenticators: The array holding the whitelisted authenticators.
/// - Parameter allowlistedAuthenticators: The array holding the allowlisted authenticators.
/// - Returns: The list of allowed authenticators.
func allowedAuthenticators(context: AuthenticatorSelectionContext, whitelistedAuthenticators: [AuthenticatorAaid]) -> [any Authenticator] {
func allowedAuthenticators(context: AuthenticatorSelectionContext, allowlistedAuthenticators: [AuthenticatorAaid]) -> [any Authenticator] {
context.authenticators.filter { authenticator in
guard let authenticatorAaid = AuthenticatorAaid(rawValue: authenticator.aaid) else { return false }
return whitelistedAuthenticators.contains(authenticatorAaid)
return allowlistedAuthenticators.contains(authenticatorAaid)
}
}
}

0 comments on commit a799e78

Please sign in to comment.