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

Add Login Spec #532

Draft
wants to merge 10 commits into
base: trunk
Choose a base branch
from
Draft

Add Login Spec #532

wants to merge 10 commits into from

Conversation

jkmassel
Copy link
Contributor

@jkmassel jkmassel commented Feb 6, 2025

As discussed with @oguzkocer – there are a lot of different things that can happen during login, so let's document them so we can ensure we're testing them for each HTTP implementation (the native Rust one, Apple platforms' URLSession, and Android)

@jkmassel jkmassel force-pushed the add/login-scenarios branch 8 times, most recently from a87e570 to b351665 Compare February 12, 2025 02:38
@jkmassel jkmassel force-pushed the add/login-scenarios branch 4 times, most recently from 68c4b18 to bc249b1 Compare February 14, 2025 20:26
Copy link
Contributor

@oguzkocer oguzkocer left a comment

Choose a reason for hiding this comment

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

@jkmassel I've left some comments about the Rust implementation. I haven't reviewed the documentation or the Swift changes yet.

}

// Does the given URL look like it's on a local development environment for the purposes of the Login Spec?
pub fn is_local_dev_environment_url(parsed_site_url: &ParsedUrl) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this only used by the testing suite? The implementation of this is pretty speculative, so if we need it for testing suite, I'd prefer if it's not part of the public API. I wouldn't mind even having separate implementations in Swift, Kotlin & Rust since it's so simple.

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 not sure if it needs to be public API at this point but it is used in two places to figure out which error message to show.

But it's an implementation detail so we can probably hide it from the public API

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'll want to move the code that uses this to Rust and then we can hide it from the API. I am still worried of it being speculative, but maybe we can address that with some naming changes for both the function name and the error message.

}

/// Does the site look like a WordPress site?
fn is_wordpress_site(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are adding this helper, we should use it in AutoDiscoveryResult::is_wordpress_site as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 8cd8bef

@@ -224,6 +227,36 @@ impl AutoDiscoveryAttemptResult {
Err(_) => None,
}
}

fn is_local_dev_environment(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please see my comment for is_local_dev_environment_url in this same file.

}

/// Returns `true` if the site URL looks like a local development environment URL.
pub fn site_url_is_local_development_environment(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please see my suggestion for is_local_dev_environment_url.


Reference Implementation: http://localhost

# 3: WordPress Admin URL Entry
Copy link
Contributor

Choose a reason for hiding this comment

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

This says WordPress Admin, but it handles both /wp-login and wp-admin cases, should we rename it?

@jkmassel jkmassel force-pushed the add/login-scenarios branch 2 times, most recently from cd36fa5 to b35616a Compare February 20, 2025 17:53
@jkmassel jkmassel force-pushed the add/login-scenarios branch from f394028 to 7e0c993 Compare February 20, 2025 20:59
@jkmassel jkmassel changed the base branch from trunk to move/login-errors-to-rust February 20, 2025 20:59
@jkmassel jkmassel force-pushed the add/login-scenarios branch 2 times, most recently from 4db0bf9 to c1983be Compare February 20, 2025 22:34
@jkmassel jkmassel force-pushed the move/login-errors-to-rust branch from 82ec5ab to 19ebcb2 Compare February 20, 2025 22:35
Base automatically changed from move/login-errors-to-rust to trunk February 20, 2025 23:02
@jkmassel jkmassel force-pushed the add/login-scenarios branch 4 times, most recently from 7a33972 to 1de057f Compare February 21, 2025 01:41
@jkmassel jkmassel force-pushed the add/login-scenarios branch from 1de057f to 17c1c30 Compare February 21, 2025 18:35
Add HTTP basic and Custom REST API prefix cases

Use RFC 2119-style writing for simplicity

Add rate limited access example

Add non-existent site example

Add Invalid SSL Cert case

Add reference implementations for each case

Fix no-https cases
Add Swift tests implementing all scenarios

Fix invalid stubs
@jkmassel jkmassel force-pushed the add/login-scenarios branch from 17c1c30 to d5f92d9 Compare February 22, 2025 06:21
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