Skip to content

Commit

Permalink
NEVISACCESSAPP-5981: Added Password authenticator capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-gulyas committed Jul 8, 2024
1 parent 59d2dd2 commit b15ec6d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 81 deletions.
60 changes: 0 additions & 60 deletions NevisExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
38E1CBF32A8E31DE00D4F7EB /* DevicePasscodeUserVerifierImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E1CBF22A8E31DE00D4F7EB /* DevicePasscodeUserVerifierImpl.swift */; };
38FF9DC5292E09E70027C09E /* CredentialView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38FF9DC4292E09E70027C09E /* CredentialView.swift */; };
38FF9DC7292E0B160027C09E /* LoggingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38FF9DC6292E0B160027C09E /* LoggingView.swift */; };
9BE0F5E78A6A916FF7E09A96 /* Pods_NevisExampleApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F141C519C68C029C049F2F79 /* Pods_NevisExampleApp.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -125,7 +124,6 @@
06000BB12C37EE6A00AB53A1 /* PasswordUserVerifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordUserVerifier.swift; sourceTree = "<group>"; };
06471B142C29685C006879F9 /* AuthenticatorAaid+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AuthenticatorAaid+Extensions.swift"; sourceTree = "<group>"; };
068E9ABB2C2D60BA0059E33C /* AuthenticatorValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticatorValidator.swift; sourceTree = "<group>"; };
0B956422D44439C093E00399 /* Pods-NevisExampleApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NevisExampleApp.release.xcconfig"; path = "Target Support Files/Pods-NevisExampleApp/Pods-NevisExampleApp.release.xcconfig"; sourceTree = "<group>"; };
382FE1D62BADD5FC00999625 /* ConfirmationPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmationPresenter.swift; sourceTree = "<group>"; };
382FE1D82BADD60400999625 /* ConfirmationScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmationScreen.swift; sourceTree = "<group>"; };
3833EB192685EA03002C5E0C /* NevisExampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NevisExampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -232,16 +230,13 @@
38E1CBF22A8E31DE00D4F7EB /* DevicePasscodeUserVerifierImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DevicePasscodeUserVerifierImpl.swift; sourceTree = "<group>"; };
38FF9DC4292E09E70027C09E /* CredentialView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredentialView.swift; sourceTree = "<group>"; };
38FF9DC6292E0B160027C09E /* LoggingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggingView.swift; sourceTree = "<group>"; };
67BBC52FF1A43798284EED29 /* Pods-NevisExampleApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NevisExampleApp.debug.xcconfig"; path = "Target Support Files/Pods-NevisExampleApp/Pods-NevisExampleApp.debug.xcconfig"; sourceTree = "<group>"; };
F141C519C68C029C049F2F79 /* Pods_NevisExampleApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NevisExampleApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
3833EB162685EA03002C5E0C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9BE0F5E78A6A916FF7E09A96 /* Pods_NevisExampleApp.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -282,8 +277,6 @@
children = (
3833EB1B2685EA03002C5E0C /* NevisExampleApp */,
3833EB1A2685EA03002C5E0C /* Products */,
A651FDC4F5C71ADD993EA999 /* Pods */,
8E9E59B3AFC9FF84E096D1EB /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -694,19 +687,9 @@
path = "Username Password Login";
sourceTree = "<group>";
};
8E9E59B3AFC9FF84E096D1EB /* Frameworks */ = {
isa = PBXGroup;
children = (
F141C519C68C029C049F2F79 /* Pods_NevisExampleApp.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
A651FDC4F5C71ADD993EA999 /* Pods */ = {
isa = PBXGroup;
children = (
67BBC52FF1A43798284EED29 /* Pods-NevisExampleApp.debug.xcconfig */,
0B956422D44439C093E00399 /* Pods-NevisExampleApp.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
Expand All @@ -718,12 +701,10 @@
isa = PBXNativeTarget;
buildConfigurationList = 3833EB2D2685EA03002C5E0C /* Build configuration list for PBXNativeTarget "NevisExampleApp" */;
buildPhases = (
79CB52AC7DDC23DF75949849 /* [CP] Check Pods Manifest.lock */,
3867C1972685EE1F00A8B98B /* Swiftformat */,
3833EB152685EA03002C5E0C /* Sources */,
3833EB162685EA03002C5E0C /* Frameworks */,
3833EB172685EA03002C5E0C /* Resources */,
B33D1E141A1B58EE4EBF5ABB /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -803,45 +784,6 @@
shellPath = /bin/sh;
shellScript = "if which swiftformat >/dev/null; then\n echo \"SwiftFormat version: $(swiftformat --version)\"\n swiftformat \"${SRCROOT}/\"\nelse\n echo \"warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat\"\nfi\n";
};
79CB52AC7DDC23DF75949849 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-NevisExampleApp-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
B33D1E141A1B58EE4EBF5ABB /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NevisExampleApp/Pods-NevisExampleApp-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-NevisExampleApp/Pods-NevisExampleApp-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NevisExampleApp/Pods-NevisExampleApp-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -1099,7 +1041,6 @@
};
3833EB2E2685EA03002C5E0C /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 67BBC52FF1A43798284EED29 /* Pods-NevisExampleApp.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand Down Expand Up @@ -1131,7 +1072,6 @@
};
3833EB2F2685EA03002C5E0C /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0B956422D44439C093E00399 /* Pods-NevisExampleApp.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand Down
3 changes: 2 additions & 1 deletion NevisExampleApp/Interaction/AuthenticatorSelectorImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AuthenticatorSelectorImpl {
/// The configuration loader.
private let configurationLoader: ConfigurationLoader

/// The mode of the current operation.
/// The current operation.
private let operation: Operation

// MARK: - Initialization
Expand All @@ -44,6 +44,7 @@ class AuthenticatorSelectorImpl {
/// - appCoordinator: The application coordinator.
/// - logger: The logger.
/// - configurationLoader: The configuration loader.
/// - operation: The current operation.
init(appCoordinator: AppCoordinator,
logger: SDKLogger,
configurationLoader: ConfigurationLoader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ extension PasswordChangerImpl: PasswordChanger {

/// You can add custom Password policy by overriding the `passwordPolicy` getter.
// func passwordPolicy() -> PasswordPolicy {
// // custom PinPolicy implementation
// // custom PasswordPolicy implementation
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ extension PasswordEnrollerImpl: PasswordEnroller {

/// You can add custom Password policy by overriding the `passwordPolicy` getter.
// func passwordPolicy() -> PasswordPolicy {
// // custom PinPolicy implementation
// // custom PasswordPolicy implementation
// }
}
23 changes: 12 additions & 11 deletions NevisExampleApp/Screens/Credential/CredentialPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ import NevisMobileAuthentication

// MARK: - Navigation

/// Navigation parameter of the Credential view.
protocol CredentialParameter: NavigationParameterizable {}

/// Navigation parameter of the Pin view.
/// Navigation parameter of the Credential view in case of PIN authenticator.
enum PinParameter: CredentialParameter {
/// Represents Pin enrollment
/// .
/// Represents PIN enrollment.
///
/// - Parameters:
/// - lastRecoverableError: The object that informs that an error occurred during PIN enrollment.
/// - handler: The PIN enrollment handler.
case enrollment(lastRecoverableError: PinEnrollmentError?,
handler: PinEnrollmentHandler)

/// Represents Pin verification.
/// Represents PIN verification.
///
/// - Parameters:
/// - protectionStatus: The object describing the PIN authenticator protection status.
Expand All @@ -30,7 +31,7 @@ enum PinParameter: CredentialParameter {
lastRecoverableError: PinUserVerificationError?,
handler: PinUserVerificationHandler)

/// Represents Pin change.
/// Represents PIN change.
///
/// - Parameters:
/// - protectionStatus: The object describing the PIN authenticator protection status.
Expand All @@ -41,10 +42,10 @@ enum PinParameter: CredentialParameter {
handler: PinChangeHandler)
}

/// Navigation parameter of the Password view.
/// Navigation parameter of the Credential view in case of Password authenticator.
enum PasswordParameter: CredentialParameter {
/// Represents Password enrollment
/// .
/// Represents Password enrollment.
///
/// - Parameters:
/// - lastRecoverableError: The object that informs that an error occurred during Password enrollment.
/// - handler: The Password enrollment handler.
Expand Down Expand Up @@ -74,12 +75,12 @@ enum PasswordParameter: CredentialParameter {

// MARK: - Presenter

/// Presenter of Pin view.
/// Presenter of Credential view.
final class CredentialPresenter {

/// Available credential operations.
enum CredentialOperation {
/// Wnrollment operation.
/// Enrollment operation.
case enrollment
/// Change operation.
case credentialChange
Expand Down Expand Up @@ -235,7 +236,7 @@ extension CredentialPresenter {
/// Returns the actual credential type.
///
/// - Returns: The actual credential type.
func getCredentialTypes() -> AuthenticatorAaid {
func getCredentialType() -> AuthenticatorAaid {
credentialType
}

Expand Down
14 changes: 7 additions & 7 deletions NevisExampleApp/Screens/Credential/CredentialScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ private extension CredentialScreen {
oldCredentialField.do {
addItem($0, topSpacing: 16)
$0.setHeight(with: 40)
$0.placeholder = presenter.getCredentialTypes() == .Pin ? L10n.Credential.Pin.oldPinPlaceholder : L10n.Credential.Password.oldPasswordPlaceholder
$0.keyboardType = presenter.getCredentialTypes() == .Pin ? .numberPad : .default
$0.placeholder = presenter.getCredentialType() == .Pin ? L10n.Credential.Pin.oldPinPlaceholder : L10n.Credential.Password.oldPasswordPlaceholder
$0.keyboardType = presenter.getCredentialType() == .Pin ? .numberPad : .default
$0.isSecureTextEntry = true
$0.inputAccessoryView = keyboardToolbar
$0.superview?.isHidden = presenter.getOperation() != .credentialChange
Expand All @@ -147,8 +147,8 @@ private extension CredentialScreen {
credentialField.do {
addItem($0, topSpacing: 16)
$0.setHeight(with: 40)
$0.placeholder = presenter.getCredentialTypes() == .Pin ? L10n.Credential.Pin.pinPlaceholder : L10n.Credential.Password.passwordPlaceholder
$0.keyboardType = presenter.getCredentialTypes() == .Pin ? .numberPad : .default
$0.placeholder = presenter.getCredentialType() == .Pin ? L10n.Credential.Pin.pinPlaceholder : L10n.Credential.Password.passwordPlaceholder
$0.keyboardType = presenter.getCredentialType() == .Pin ? .numberPad : .default
$0.isSecureTextEntry = true
$0.inputAccessoryView = keyboardToolbar
}
Expand Down Expand Up @@ -192,7 +192,7 @@ private extension CredentialScreen {
}
}

// MARK: - PinView
// MARK: - CredentialView

/// :nodoc:
extension CredentialScreen: CredentialView {
Expand All @@ -217,12 +217,12 @@ private extension CredentialScreen {
@objc
func confirm() {
if presenter.getOperation() == .credentialChange, oldCredentialField.text.isEmptyOrNil {
errorLabel.text = presenter.getCredentialTypes() == .Pin ? L10n.Credential.Pin.missingOldPin : L10n.Credential.Password.missingOldPassword
errorLabel.text = presenter.getCredentialType() == .Pin ? L10n.Credential.Pin.missingOldPin : L10n.Credential.Password.missingOldPassword
return
}

guard let credential = credentialField.text, !credential.isEmpty else {
errorLabel.text = presenter.getCredentialTypes() == .Pin ? L10n.Credential.Pin.missingPin : L10n.Credential.Password.missingPassword
errorLabel.text = presenter.getCredentialType() == .Pin ? L10n.Credential.Pin.missingPin : L10n.Credential.Password.missingPassword
return
}

Expand Down

0 comments on commit b15ec6d

Please sign in to comment.