Skip to content

Conversation

@orgads
Copy link
Contributor

@orgads orgads commented Jan 31, 2024

When running az login, the URL has localhost in redirect_uri query param. This should trigger automatic port mapping.

Improve localhost port mapping to cover this case as well.

@orgads
Copy link
Contributor Author

orgads commented Jan 31, 2024

cc @yoshigev

@orgads
Copy link
Contributor Author

orgads commented Jan 31, 2024

I couldn't get the Remote-SSH extension to work with OSS version (I keep getting "Unauthorized client refused." messages), so I have no way to test this.

Suggestions?

@orgads
Copy link
Contributor Author

orgads commented Feb 1, 2024

Added unit tests.

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

I couldn't get the Remote-SSH extension to work with OSS version (I keep getting "Unauthorized client refused." messages), so I have no way to test this.

Suggestions?

We have a test resolver which can be used in OSS to test remote changes. You can try it out with OSS by using the "Remote-TestResolver" commands. I think for port forwarding it forwards to remote-port-number + 1.

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

This is a cool idea. Let me discuss with the team and get back to you on it!

Copy link
Member

@alexr00 alexr00 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, I would merge this once the second argument is added!

@orgads
Copy link
Contributor Author

orgads commented Feb 6, 2024

@alexr00 No problem. Are you ok with @yoshigev's suggestion?

@alexr00
Copy link
Member

alexr00 commented Feb 6, 2024

@orgads I prefer your current approach because it does a URI.parse and then only looks specifically at the authority.

@orgads orgads force-pushed the tunnel-az-login branch 2 times, most recently from 34726f6 to 5f66af9 Compare February 6, 2024 11:21
When running az login, the URL has localhost in redirect_uri query
param. This should trigger automatic port mapping.

Improve localhost port mapping to cover this case as well.

Fixes microsoft#203869
@orgads orgads requested a review from alexr00 February 6, 2024 13:10
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

Thanks for the feature and for adding tests!

@alexr00 alexr00 added this to the February 2024 milestone Feb 6, 2024
@alexr00 alexr00 enabled auto-merge (squash) February 6, 2024 15:55
@alexr00 alexr00 merged commit 08eda83 into microsoft:main Feb 6, 2024
@orgads orgads deleted the tunnel-az-login branch February 7, 2024 03:55
@orgads
Copy link
Contributor Author

orgads commented Feb 9, 2024

@orgads
Copy link
Contributor Author

orgads commented Feb 9, 2024

The port is forwarded correctly anyway. If I open the correct links, it works as expected.

@orgads
Copy link
Contributor Author

orgads commented Feb 9, 2024

@orgads
Copy link
Contributor Author

orgads commented Feb 16, 2024

alexr00 added a commit that referenced this pull request Feb 16, 2024
alexr00 added a commit that referenced this pull request Feb 16, 2024
orgads added a commit to orgads/vscode that referenced this pull request Feb 18, 2024
When running az login, the URL has localhost in redirect_uri query
param. This should trigger automatic port mapping.

Improve localhost port mapping to cover this case as well.

This is a revised and tested version of microsoft#203908 which was reverted
in microsoft#205370.

Fixes microsoft#203869
orgads added a commit to orgads/vscode that referenced this pull request Mar 1, 2024
When running az login, the URL has localhost in redirect_uri query
param. This should trigger automatic port mapping.

Improve localhost port mapping to cover this case as well.

This is a revised and tested version of microsoft#203908 which was reverted
in microsoft#205370.

Fixes microsoft#203869
alexr00 pushed a commit that referenced this pull request Mar 7, 2024
When running az login, the URL has localhost in redirect_uri query
param. This should trigger automatic port mapping.

Improve localhost port mapping to cover this case as well.

This is a revised and tested version of #203908 which was reverted
in #205370.

Fixes #203869
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic port forward for redirect uri (OAuth 2.0 authorization code flow)

6 participants