Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pass headers to coder api #81

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

Closed
wants to merge 10 commits into from
Closed

pass headers to coder api #81

wants to merge 10 commits into from

Conversation

Liorba
Copy link

@Liorba Liorba commented Apr 17, 2023

Hey coder team this pr tries to tackle issue #76
This pr added the following functionality to the vscode extension:

  1. new set of configuration to set a VPN header
  2. option to set the token directly in settings.json or in file
  3. if header name is set and non of the option above was not provided a user will be presented by prompt widow to add his token (similar to session token)
  4. if a valid header it will be added to Axios global headers.
  5. To deal with a case that the provided token expired of invalid after some time, I've added new Axios interceptor. which will check a set of conditions and prompt the user to put new case it discover a bad response due to invalid token
  6. pass the vpn header name and token to the SSH config proxyCommand

There is an issue with the coder vpnssh command that unlike the ssh command do not pass the headers correctly to the underline ssh command. when I replace it with the "regular" ssh command it worked. any Idea what might causing this?

@kylecarbs
Copy link
Member

@Liorba I fixed the header problem in the attached PR: coder/coder#7181

I'll review the rest shortly!

Copy link
Member

@deansheather deansheather left a comment

Choose a reason for hiding this comment

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

This should probably just be a map of header name to string or file path so people can set multiple headers

Liorba and others added 2 commits April 18, 2023 09:48
Co-authored-by: Dean Sheather <[email protected]>
Co-authored-by: Dean Sheather <[email protected]>
@Liorba
Copy link
Author

Liorba commented Apr 17, 2023

@deansheather,I thought about this approach at first, but this is no regular header. it sort of like the session token which is a header but has a special treatments.

@kylecarbs
Copy link
Member

@Liorba is it alright if I work off of your code and change some things? I want to make it more generic so that it's not so VPN-specific (even though that will be the first-class use-case).

@Liorba
Copy link
Author

Liorba commented Apr 18, 2023

@kylecarbs sure mate!
what change did you have in mind? I can probably work on that as well if you like.
TBH, the reason I didn't went on the generic approach at the first place is that the VPN header are completely different beast than any other header because :

  • it can be expired, and we need to catch that
  • it need to to be stored between sessions
  • we need to pass it to the ssh command.
    Due to that it seems like more related to the session-token implementation in the extension (which itself being pass as a header)
    LMK how can I help in any direction you may choose.

@rodrimaia rodrimaia self-assigned this Jun 12, 2023
@kylecarbs
Copy link
Member

@rodrimaia let's make this more generic with coder.headers instead to allow for a series of arbitrary headers!

@bpmct
Copy link
Member

bpmct commented Aug 18, 2023

We did this in #119!

@bpmct bpmct closed this Aug 18, 2023
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.

6 participants