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

Feature/waas integration auth #41

Merged
merged 29 commits into from
Dec 20, 2023
Merged

Conversation

BellringerQuinn
Copy link
Contributor

Authenticate into WaaS using social sign in

Validated on:

  • macOS
  • PC
  • Android
  • iOS (using idToken obtained from the demo app's Google login as iOS devices cannot reach ngrok servers (at least not the free ones))

…authenticate with the WaaS API and receive our JWT (used to create a WaaSWallet).

SequenceWaaS assembly now references the SequenceAuthentication assembly. WaaSLogin requires the ILogin interface and the OpenIdAuthenticator class (which implements OpenID Connect to obtain the id_token, access_token, and occasionally refresh_token from the social sign in provider). WaaSLogin will also require an EthWallet (from the SequenceEthereum assembly); SequenceAuthentication does not depend on SequenceEthereum (nor should it); SequenceWaaS already depends on SequenceEthereum -> this is why WaaSLogin is part of the SequenceWaaS assembly as opposed to the SequenceAuthentication assembly.
SequenceExamples assembly now depends on the SequenceWaaS assembly. This was an inevitability since SequenceExamples would've needed to create a WaaS wallet at some point (even if it relies upon the IWallet interface from SequenceEthereum throughout). Note that SequenceExamples depends on all other Sequence assemblies in the project, as you might expect.
…t_secret - each client will use their own client_id so we can identify the partner
…CPP to build instead. Remove MacOS specific setup code for deep linking that throws errors on IL2CPP (and doesn't seem to be required). Added additional section to docs, Supported Platforms, to make a note of this.
…credentials. Moved WaaS login related classes to their own files in WaaS/DataTypes/Authentication
…Session and WaaSSessionData classes into their own file and outside the RegisterSessionResponse class definition so that they can be more readily re-used
…aky. Fixing the flakyness is proving to be challenging and time consuming and likely not worth the effort
… Expand UI tests using mocks to test that we can navigate to the LoginSuccessPage from the LoginPage via the social sign in buttons.
Base automatically changed from Feature/WaaSIntegration to master December 18, 2023 15:59
@@ -254,14 +254,15 @@ public async Task TestWalletSignMessage()

private static IEnumerable<object[]> iWalletTestCases()
{
var adapter = WaaSToWalletAdapter.CreateAsync(new WaaSWallet(
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXJ0bmVyX2lkIjoyLCJ3YWxsZXQiOiIweDY2MDI1MDczNGYzMTY0NDY4MWFlMzJkMDViZDdlOGUyOWZlYTI5ZTEifQ.FC8WmaC_hW4svdrs4rxyKcvoekfVYFkFFvGwUOXzcHA")).Result;
// TOdo fix test
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Auth no longer works this way

private string ExtractIssFromJwt(string jwt)
{
IdTokenJwtPayload payload = JwtHelper.GetIdTokenJwtPayload(jwt);
return payload.iss.Replace("https://", "").Replace("http://", "");
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Including the https:// or http:// in the iss will give error:
Error fetching credentials from AWS: Invalid login token. Issuer doesn't match providerName
If I recall correctly, the backend is matching with a string and doesn't expect those to be there

private static readonly string DiscordClientId = ""; // Todo replace
private static readonly string FacebookClientId = ""; // Todo replace
private static readonly string AppleClientId = ""; // Todo replace
private static readonly string RedirectUrl = "https://3d41-142-115-54-118.ngrok-free.app/";
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume these are configurable in the GUI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's my understanding that everyone using our oauth system should have the same client ids, so they are hardcoded for now. Easy to expose them as I've done with the redirect url if need be.

private static readonly string DiscordClientId = ""; // Todo replace
private static readonly string FacebookClientId = ""; // Todo replace
private static readonly string AppleClientId = ""; // Todo replace
private static readonly string RedirectUrl = "https://3d41-142-115-54-118.ngrok-free.app/";
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume these are configurable in the GUI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Redirect URL, yes, in a later PR. For now, they are hardcoded

Copy link
Contributor

@taylanpince taylanpince left a comment

Choose a reason for hiding this comment

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

Looks good, just added a couple of clarification questions.

@BellringerQuinn BellringerQuinn merged commit b8a15ce into master Dec 20, 2023
@BellringerQuinn BellringerQuinn deleted the Feature/WaaSIntegration_auth branch December 20, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants