Skip to content

Instantly share code, notes, and snippets.

@MrTrick
Created September 24, 2010 05:13
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 MrTrick/594894 to your computer and use it in GitHub Desktop.
Save MrTrick/594894 to your computer and use it in GitHub Desktop.
//Response produced when using no credentials,
//$ curl http://minion:5984/cgm/_fti/_design/couchapp/user
//
{"error":"unauthorized","reason":"You are not authorized to access this db."}
//Response produced when using credentials that do not have access,
//$ curl http://nobody:nobody@minion:5984/cgm/_fti/_design/couchapp/user
//
{"error":"unauthorized","reason":"You are not authorized to access this db."}
//Response produced when using credentials that *should* have access,
//$ curl http://admin:adminpw@minion:5984/cgm/_fti/_design/couchapp/user
// (newlines were added to help readability)
//
{"code":500,
"reason":"A JSONObject text must begin with '{' at character 1 of
<!DOCTYPE html>\n
<!--\n
\n
Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n
this file except in compliance with the License. You may obtain a copy of the\n
License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n
\n
Unless required by applicable law or agreed to in writing, software distributed\n
under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n
CONDITIONS OF ANY KIND, either express or implied. See the License for the\n
specific language governing permissions and limitations under the License.\n
\n
-->\n
<html lang=\"en\">\n
<head>\n
<title>Session<\/title>\n
<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n
<link rel=\"stylesheet\" href=\"style/layout.css?0.11.0\" type=\"text/css\">\n
<script src=\"script/json2.js\"><\/script>\n
<script src=\"script/sha1.js\"><\/script>\n
<script src=\"script/jquery.js?1.4.2\"><\/script>\n
<script src=\"script/jquery.couch.js?0.11.0\"><\/script>\n
<script src=\"script/jquery.dialog.js?0.11.0\"><\/script>\n
<script src=\"script/futon.js?0.11.0\"><\/script>\n
<script src=\"script/futon.browse.js?0.11.0\"><\/script>\n
<script src=\"script/futon.format.js?0.11.0\"><\/script>\n
<script>\n
$(function() {\n
var ret, reason, q = window.location.search, qps = q.split(\"&\");\n
$.map(qps, function(qp) {\n
var m = qp.match(/return=(.*)/);\n
if (m) {\n
ret = decodeURIComponent(m[1]);\n
}\n
m = qp.match(/reason=(.*)/);\n
if (m) {\n
reason = decodeURIComponent(m[1]);\n
}\n
});\n
if (reason) {\n
$(\"#aboutSession\").append('<p>The application says: <em>'+reason+'<\/em><\/p>');\n
}\n
if (ret) {\n
$(\"#aboutSession\").append($('<p>Once you are logged in, click this link to return to your application: <\/p>').append($(\"<a><\/a>\").attr(\"href\", ret).text(ret)));\n
// todo this needs to look different if you are already logged in\n
// a note about you are logged in but you can't access this\n
}\n
// do the sidebar but in the middle without the sidebar\n
$.futon.storage.set(\"sidebar\", \"hidden\");\n
setTimeout(function() {\n
var ctx = $$(\"#userCtx\").userCtx;\n
$.futon.storage.set(\"sidebar\", \"show\");\n
if (ctx && ctx.name) {\n
$(\"#aboutSession\").append(\"<p>It looks like you are logged in, maybe you don't have access to that url.<\/p>\");\n
}\n
},100);\n
});\n
<\/script>\n
<\/head>\n
<body>\n
<div id=\"wrap\">\n
<h1><a href=\"index.html\">Overview<\/a>\n
<strong>Session<\/strong><\/h1>\n
<div id=\"content\">\n
<h2>Establish or Modify Your Session<\/h2>\n
<div id=\"loginSignup\">\n
<div id=\"aboutSession\"><\/div>\n
<span id=\"userCtx\">\n
<span class=\"loggedout\">\n
<a href=\"#\" class=\"signup\">Signup<\/a> or <a href=\"#\" class=\"login\">Login<\/a>\n
<\/span>\n
<span class=\"loggedin\">\n
Welcome <a class=\"name\">?<\/a>!\n
<br/>\n
<a href=\"#\" class=\"logout\">Logout<\/a>\n
<\/span>\n
<span class=\"loggedinadmin\">\n
Welcome <a class=\"name\">?<\/a>!\n
<br/>\n
<a href=\"#\" class=\"createadmin\">Setup more admins<\/a> or\n
<a href=\"#\" class=\"logout\">Logout<\/a>\n
<\/span>\n
<span class=\"adminparty\">\n
Welcome to Admin Party!\n
<br/>\n
Everyone is admin. <a href=\"#\" class=\"createadmin\">Fix this<\/a>\n
<\/span>\n
<\/span>\n
<\/div>\n
<\/div>\n
\n
<\/div>\n
<\/body>\n
<\/html>"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment