Skip to content

Instantly share code, notes, and snippets.

@davsclaus
Created April 19, 2013 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davsclaus/5420939 to your computer and use it in GitHub Desktop.
Save davsclaus/5420939 to your computer and use it in GitHub Desktop.
/**
* Parses the username:password from a http basic auth URL, e.g.
* http://foo:bar@example.com
*/
hawtioPluginLoader.getCredentials = function(url) {
var uri = new Uri(url);
Uncaught ReferenceError: Uri is not defined
var credentials = uri.userInfo();
if (credentials.indexOf(':') > -1) {
return credentials.split(':');
}
return [];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment