Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Bot Protection verification [SDK-1867] #629

Merged
merged 5 commits into from
Aug 25, 2020

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Aug 25, 2020

Changes

This PR adds support for the Bot Protection feature that requires a web-based verification step when the database login/signup request is flagged as suspicious. The verification step is implemented with Universal Login, and will automatically kick in when the .isAuthenticationRequired error is returned by Auth0.swift.

Testing

Both login and signup flows were also tested manually.

  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@Widcket Widcket added this to the vNext milestone Aug 25, 2020
@Widcket Widcket requested a review from a team August 25, 2020 17:49
@@ -1431,7 +1431,6 @@
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.Lock;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "97f7985c-a5ce-42be-a3e5-39a6c818bc78";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This provisioning profile was always hardcoded into the test app and was a nuisance since you had to remove it manually to run the app in a physical device. The app should have no references to any certificates or provisioning profiles.

default:
return true
}
}
}

extension CredentialAuthError: Equatable {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error must implement Equatable for the test matcher to correctly compare the expected vs the actual.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this enum has associated values; in regular enums (meaning, enums without associated values) it's not necessary to add Equatable conformance.

@@ -103,7 +105,19 @@ struct DatabaseInteractor: DatabaseAuthenticatable, DatabaseUserCreator, Loggabl

self.credentialAuth
.request(withIdentifier: identifier, password: password, options: self.options)
.start { self.handle(identifier: identifier, result: $0, callback: callback) }
.start { result in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm basically chaining two interactors together, and wrapping the error of the second in an error of the first.

Lock/Auth0OAuth2Interactor.swift Outdated Show resolved Hide resolved
Lock/DatabaseInteractor.swift Show resolved Hide resolved
Lock/Auth0OAuth2Interactor.swift Outdated Show resolved Hide resolved
Lock/DatabaseInteractor.swift Show resolved Hide resolved
Lock/DatabaseInteractor.swift Show resolved Hide resolved
@Widcket Widcket merged commit a9fee60 into master Aug 25, 2020
@Widcket Widcket deleted the feature/bot-protection branch August 25, 2020 20:33
@Widcket Widcket mentioned this pull request Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants