Skip to content

Don't unset credentials when switching endpoints #183

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

Merged
merged 2 commits into from
Oct 15, 2015

Conversation

mseashor
Copy link
Contributor

If multiple secured endpoints exist in an API, it becomes cumbersome to re-enter credentials for every end point when using the API console.

This commit moves the initialization of credentials from the endpoint to the raml directives so credentials will be reused until you reload the page.

This is initial issue post: #180

Example RAML (before, credentials would be blanked out between 'test' and 'test2', now they are stored until page refresh):

#%RAML 0.8
title: test
baseUri: /api
securitySchemes:
  - basic:
      type: Basic Authentication
traits:
  - secured:
      securedBy: [ basic ]
/test:
  get:
    is: [ secured ]
/test2:
  get:
    is: [ secured ]                   

@pipex
Copy link

pipex commented Oct 1, 2015

I really like this.

I'm testing with the 'resource owner password credentials' scheme and is really annoying to re-fill four fields each time.

I hope it gets merged :)

…l. This results in credentials being reused for different endpoints for convenience. This should not be a security issue as credentials are only cached in memory and not written out, etc.
@mseashor
Copy link
Contributor Author

This should be ready to go.

I added a test which uses two resources to ensure credentials filled out on the first resources are cached when switching to the second.

FYI: It took me a while to figure out why my new test kept failing. It's because TravisCI runs at a resolution by default that is not wide enough to show the 'Try It' functionality (it's collapsed and user/pass are hidden to save space). I added another commit which instructs TravisCI to update the default resolution. I believe this will be helpful for avoiding this confusing issue in the future. I modeled the fix after TravisCI's recommended way to do this: http://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-GUI-(e.g.-a-Web-browser)

@mseashor
Copy link
Contributor Author

Also - I signed the contributors agreement: https://api-notebook.anypoint.mulesoft.com/notebooks#bc1cf75a0284268407e4

@mseashor mseashor closed this Oct 15, 2015
@mseashor mseashor reopened this Oct 15, 2015
@jcenturion
Copy link
Contributor

LGTM. 👍 Thx.

@jcenturion
Copy link
Contributor

Merging ...

jcenturion added a commit that referenced this pull request Oct 15, 2015
Don't unset credentials when switching endpoints
@jcenturion jcenturion merged commit 45dfb82 into mulesoft:master Oct 15, 2015
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.

3 participants