-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: trunk
Are you sure you want to change the base?
Add Login Spec #532
Conversation
a87e570
to
b351665
Compare
68c4b18
to
bc249b1
Compare
There was a problem hiding this 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.
wp_api/src/login/url_discovery.rs
Outdated
} | ||
|
||
// 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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
wp_api/src/login/url_discovery.rs
Outdated
} | ||
|
||
/// Does the site look like a WordPress site? | ||
fn is_wordpress_site(&self) -> bool { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 8cd8bef
wp_api/src/login/url_discovery.rs
Outdated
@@ -224,6 +227,36 @@ impl AutoDiscoveryAttemptResult { | |||
Err(_) => None, | |||
} | |||
} | |||
|
|||
fn is_local_dev_environment(&self) -> bool { |
There was a problem hiding this comment.
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.
wp_api/src/login.rs
Outdated
} | ||
|
||
/// Returns `true` if the site URL looks like a local development environment URL. | ||
pub fn site_url_is_local_development_environment(&self) -> bool { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
cd36fa5
to
b35616a
Compare
f394028
to
7e0c993
Compare
4db0bf9
to
c1983be
Compare
82ec5ab
to
19ebcb2
Compare
7a33972
to
1de057f
Compare
1de057f
to
17c1c30
Compare
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
17c1c30
to
d5f92d9
Compare
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)