Content-Length: 433179 | pFad | https://github.com/auth0/Lock.swift/pull/528

A0 Added OIDC MFA Support by cocojoe · Pull Request #528 · auth0/Lock.swift · GitHub
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 OIDC MFA Support #528

Merged
merged 3 commits into from
Oct 30, 2018
Merged

Added OIDC MFA Support #528

merged 3 commits into from
Oct 30, 2018

Conversation

cocojoe
Copy link
Member

@cocojoe cocojoe commented Oct 23, 2018

Changes

This PR adds support for the OIDC MFA endpoint.
https://github.com/auth0/Auth0.swift/blob/master/Auth0/Auth0Authentication.swift#L75

References

Internal 282

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

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

Checklist

Capture MFA Token
Added Route for MFA with Token
@@ -118,6 +118,10 @@ class DatabasePresenter: Presentable, Loggable {
}
if case CredentialAuthError.multifactorRequired = error {
self.navigator.navigate(.multifactor)
return
} else if case CredentialAuthError.multifactorTokenRequired(let token) = error {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this syntax doing? I'm confused with the let there. Sounds like you're declaring a function instead of calling one

Copy link
Member Author

Choose a reason for hiding this comment

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

Traditionally you would need to do a switch statement, this is a quick way to check a single case value, if the case matches and I want to get the value of the param that was passed with multifactorTokenRequired Then I need to extract it from the case. Here were do let token so I can extract the token that was passed and use it inside the if block.

@@ -72,6 +73,8 @@ func == (lhs: Route, rhs: Route) -> Bool {
return lhsConnection.name == rhsConnection.name && lhsDomain == rhsDomain
case (.unrecoverableError(let lhsError), .unrecoverableError(let rhsError)):
return lhsError == rhsError
case (.multifactorWithToken(let lhsToken), .multifactorWithToken(let rhsToken)):
return lhsToken == rhsToken
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this naming? lhs / rhs

Copy link
Member Author

Choose a reason for hiding this comment

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

left hand side, right hand side.

@@ -690,13 +691,13 @@ class DatabaseInteractorSpec: QuickSpec {
}
}

it("should indicate that mfa is required") {
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this still the case for non-oidc clients? This test should be kept

Copy link
Member Author

Choose a reason for hiding this comment

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

yes the description just changed and in OIDC it will always be the with token path.

}
}

it("should notify when code is invalid") {
Copy link
Contributor

Choose a reason for hiding this comment

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

code or token? because you're passing "invalid token" in mfaToken

}

it("should yield error on failure") {
interactor = MultifactorInteractor(user: user, authentication: Auth0.authentication(clientId: clientId, domain: domain), connection: connection, options: options, dispatcher: dispatcher, mfaToken: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the precondition for this test to fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll update description, if token is not present,

}

it("should yield error when input is not valid") {
waitUntil(timeout: 2) { done in
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the precondition for this test to fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

No input e.g. no code

@@ -658,6 +666,15 @@ class DatabasePresenterSpec: QuickSpec {
view.primaryButton?.onPress(view.primaryButton!)
expect(navigator.route).toEventually(equal(Route.multifactor))
}

it("should navigate to multifactor token required screen") {
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like a dupe of a test added 200 lines above, but the test name is not exactly the same. That aside, why is this added twice? (file too long to check 🚎 )

Copy link
Member Author

Choose a reason for hiding this comment

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

It is but it's part of the sign up logic flow that will try to login after sign up.

var json = ["error": code, "error_description": description]
json["name"] = name
json += jsonExtra
Copy link
Contributor

Choose a reason for hiding this comment

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

this is overwriting the json map with the keys in jsonExtra, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@cocojoe cocojoe merged commit 9fc500b into master Oct 30, 2018
@cocojoe cocojoe deleted the added-oidc-mfa branch October 30, 2018 12:18
@cocojoe cocojoe added this to the v2-Next milestone Oct 31, 2018
@cocojoe cocojoe changed the title Added oidc mfa Added OIDC MFA Support Oct 31, 2018
@cocojoe cocojoe mentioned this pull request Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/auth0/Lock.swift/pull/528

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy