first commit

This commit is contained in:
Benjamin Dauvergne 2012-07-11 15:06:24 +02:00
commit 645279036d
11 changed files with 1111 additions and 0 deletions

28
README.txt Normal file
View File

@ -0,0 +1,28 @@
Simple IdP Discovery Store and Query
====================================
How to use
----------
Copy this code in your web app.
Place the response.html somewhere, let's say at http://sp.example.com/response.html.
Add this:
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.qs.js"></script>
<script type="text/javascript" src="discoquery.js"></script>
<script type="text/javascript" src="debug.js"></script>
And make the linked files accessible.
Call this to get the globally stored preference:
$.disco_query("http://sp.example.com/metadata", "http://disco.example.com/store", "http://sp.example.com/response.html", function (entity_id, auth) {
// do something with it
});
Call this to store your preference:
$.disco_query("http://sp.example.com/metadata", "http://chosen_idp.example.com/metadata", "http://disco.example.com/store", "http://sp.example.com/response.html");

6
debug.js Normal file
View File

@ -0,0 +1,6 @@
debug = false;
function debug_alert(msg) {
if (debug) {
alert(msg);
}
}

62
discoquery.js Normal file
View File

@ -0,0 +1,62 @@
(function () {
var C_ENTITY_ID = "entityID";
var C_RETURN = "return";
var C_POLICY = "policy";
var C_RETURNIDPARAM = "returnIDParam";
var C_IS_PASSIVE = "isPassive";
var C_IDP_ENTITY_ID = "IdPentityID";
var COOKIE_TIMEOUT_DAYS = 730;
$.disco_query = function (entity_id, url, response_url, callback) {
var iframe = $('<iframe style="display: none"/>');
var query_url = url;
if (url.indexOf('?') == -1) {
query_url = query_url + '?';
} else {
query_url = query_url + '&';
}
var param = {};
param[C_ENTITY_ID] = entity_id;
param[C_RETURN] = response_url;
param[C_IS_PASSIVE] = 'true';
query_url = query_url + $.param(param);
debug_alert('query_url '+query_url);
iframe.attr('src', query_url);
if (callback) {
var disco_callback = function (entity_id, auth) {
callback(entity_id, auth);
$(iframe).remove();
};
window.disco_callback = disco_callback;
} else {
window.disco_callback = undefined;
}
$(iframe).appendTo('body');
}
$.disco_set = function (entity_id, idp_entity_id, url, response_url, callback) {
var iframe = $('<iframe style="display: none"/>');
var query_url = url;
if (url.indexOf('?') == -1) {
query_url = query_url + '?';
} else {
query_url = query_url + '&';
}
var param = {};
param[C_ENTITY_ID] = entity_id;
param[C_RETURN] = response_url;
param[C_IDP_ENTITY_ID] = idp_entity_id;
query_url = query_url + $.param(param);
debug_alert('query_url '+query_url);
iframe.attr('src', query_url);
if (callback) {
var disco_callback = function (entity_id, auth) {
callback(entity_id, auth);
$(iframe).remove();
};
window.disco_callback = disco_callback;
} else {
window.disco_callback = undefined;
}
$(iframe).appendTo('body');
}
})();

828
doc/discoreadwrite.txt Normal file
View File

@ -0,0 +1,828 @@
<!DOCTYPE html>
<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>DiscoJuice/docs/discoreadwrite.txt at master · andreassolberg/DiscoJuice · GitHub</title>
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="apple-touch-icon-114.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-144.png" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144.png" />
<meta content="authenticity_token" name="csrf-param" />
<meta content="GB7yEOi0lx3020NTj/0WB8/QBQmmhz/quMSSuV3XaF0=" name="csrf-token" />
<link href="https://a248.e.akamai.net/assets.github.com/assets/github-7da8766be009b5437506fcf8d192fd111c219ec8.css" media="screen" rel="stylesheet" type="text/css" />
<link href="https://a248.e.akamai.net/assets.github.com/assets/github2-06963f1261440da9c40e4c988a33c023ac13be2e.css" media="screen" rel="stylesheet" type="text/css" />
<script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-41bb9f3a8ce0b760dd1d2428c5727a0cec9bf9bd.js" type="text/javascript"></script>
<script defer="defer" src="https://a248.e.akamai.net/assets.github.com/assets/github-df1bc4b6528ef3bc0903513d4afff68cf438ab19.js" type="text/javascript"></script>
<link rel='permalink' href='/andreassolberg/DiscoJuice/blob/f157088df59418f584ba18aa37060ee8c44d835b/docs/discoreadwrite.txt'>
<meta property="og:title" content="DiscoJuice"/>
<meta property="og:type" content="githubog:gitrepository"/>
<meta property="og:url" content="https://github.com/andreassolberg/DiscoJuice"/>
<meta property="og:image" content="https://a248.e.akamai.net/assets.github.com/images/gravatars/gravatar-140.png?1329275985"/>
<meta property="og:site_name" content="GitHub"/>
<meta property="og:description" content="DiscoJuice a javascript Login Discovery UI. Contribute to DiscoJuice development by creating an account on GitHub."/>
<meta name="description" content="DiscoJuice a javascript Login Discovery UI. Contribute to DiscoJuice development by creating an account on GitHub." />
<link href="https://github.com/andreassolberg/DiscoJuice/commits/master.atom" rel="alternate" title="Recent Commits to DiscoJuice:master" type="application/atom+xml" />
</head>
<body class="logged_out page-blob vis-public env-production " data-blob-contribs-enabled="yes">
<div id="wrapper">
<div id="header" class="true clearfix">
<div class="container clearfix">
<a class="site-logo" href="https://github.com/">
<!--[if IE]>
<img alt="GitHub" class="github-logo" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7.png?1323882804" />
<img alt="GitHub" class="github-logo-hover" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7-hover.png?1324325453" />
<![endif]-->
<img alt="GitHub" class="github-logo-4x" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x.png?1337118068" />
<img alt="GitHub" class="github-logo-4x-hover" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x-hover.png?1337118068" />
</a>
<!--
make sure to use fully qualified URLs here since this nav
is used on error pages on other domains
-->
<ul class="top-nav logged_out">
<li class="pricing"><a href="https://github.com/plans">Signup and Pricing</a></li>
<li class="explore"><a href="https://github.com/explore">Explore GitHub</a></li>
<li class="features"><a href="https://github.com/features">Features</a></li>
<li class="blog"><a href="https://github.com/blog">Blog</a></li>
<li class="login"><a href="https://github.com/login?return_to=%2Fandreassolberg%2FDiscoJuice%2Fblob%2Fmaster%2Fdocs%2Fdiscoreadwrite.txt">Sign in</a></li>
</ul>
</div>
</div>
<div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
<div class="container hentry">
<div class="pagehead repohead instapaper_ignore readability-menu">
<div class="title-actions-bar">
<ul class="pagehead-actions">
<li>
<span class="watch-button"><a href="/login?return_to=%2Fandreassolberg%2FDiscoJuice" class="minibutton btn-watch js-toggler-target entice tooltipped leftwards" title="You must be signed in to use this feature" rel="nofollow">Watch</a><a class="social-count js-social-count" href="/andreassolberg/DiscoJuice/watchers">3</a></span>
</li>
<li>
<a href="/login?return_to=%2Fandreassolberg%2FDiscoJuice" class="minibutton btn-fork js-toggler-target fork-button entice tooltipped leftwards" title="You must be signed in to use this feature" rel="nofollow">Fork</a><a href="/andreassolberg/DiscoJuice/network" class="social-count">2</a>
</li>
</ul>
<h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
<span class="repo-label"><span>public</span></span>
<span class="mega-icon mega-icon-public-repo"></span>
<span class="author vcard">
<a href="/andreassolberg" class="url fn" itemprop="url" rel="author"> <span itemprop="title">andreassolberg</span>
</a></span> /
<strong><a href="/andreassolberg/DiscoJuice" class="js-current-repository">DiscoJuice</a></strong>
</h1>
</div>
<ul class="tabs">
<li><a href="/andreassolberg/DiscoJuice" class="selected" highlight="repo_sourcerepo_downloadsrepo_commitsrepo_tagsrepo_branches">Code</a></li>
<li><a href="/andreassolberg/DiscoJuice/network" highlight="repo_network">Network</a>
<li><a href="/andreassolberg/DiscoJuice/pulls" highlight="repo_pulls">Pull Requests <span class='counter'>0</span></a></li>
<li><a href="/andreassolberg/DiscoJuice/issues" highlight="repo_issues">Issues <span class='counter'>28</span></a></li>
<li><a href="/andreassolberg/DiscoJuice/graphs" highlight="repo_graphsrepo_contributors">Graphs</a></li>
</ul>
<div class="frame frame-center tree-finder" style="display:none"
data-tree-list-url="/andreassolberg/DiscoJuice/tree-list/f157088df59418f584ba18aa37060ee8c44d835b"
data-blob-url-prefix="/andreassolberg/DiscoJuice/blob/f157088df59418f584ba18aa37060ee8c44d835b"
>
<div class="breadcrumb">
<span class="bold"><a href="/andreassolberg/DiscoJuice">DiscoJuice</a></span> /
<input class="tree-finder-input js-navigation-enable" type="text" name="query" autocomplete="off" spellcheck="false">
</div>
<div class="octotip">
<p>
<a href="/andreassolberg/DiscoJuice/dismiss-tree-finder-help" class="dismiss js-dismiss-tree-list-help" title="Hide this notice forever" rel="nofollow">Dismiss</a>
<span class="bold">Octotip:</span> You've activated the <em>file finder</em>
by pressing <span class="kbd">t</span> Start typing to filter the
file list. Use <span class="kbd badmono">↑</span> and
<span class="kbd badmono">↓</span> to navigate,
<span class="kbd">enter</span> to view files.
</p>
</div>
<table class="tree-browser" cellpadding="0" cellspacing="0">
<tr class="js-header"><th>&nbsp;</th><th>name</th></tr>
<tr class="js-no-results no-results" style="display: none">
<th colspan="2">No matching files</th>
</tr>
<tbody class="js-results-list js-navigation-container">
</tbody>
</table>
</div>
<div id="jump-to-line" style="display:none">
<h2>Jump to Line</h2>
<form accept-charset="UTF-8">
<input class="textfield" type="text">
<div class="full-button">
<button type="submit" class="classy">
Go
</button>
</div>
</form>
</div>
<div class="subnav-bar">
<ul class="actions subnav">
<li><a href="/andreassolberg/DiscoJuice/tags" class="blank" highlight="repo_tags">Tags <span class="counter">0</span></a></li>
<li><a href="/andreassolberg/DiscoJuice/downloads" class="blank downloads-blank" highlight="repo_downloads">Downloads <span class="counter">0</span></a></li>
</ul>
<ul class="scope">
<li class="switcher">
<div class="context-menu-container js-menu-container js-context-menu">
<a href="#"
class="minibutton bigger switcher js-menu-target js-commitish-button btn-branch repo-tree"
data-hotkey="w"
data-master-branch="master"
data-ref="master">
<span><i>branch:</i> master</span>
</a>
<div class="context-pane commitish-context js-menu-content">
<a href="javascript:;" class="close js-menu-close"><span class="mini-icon mini-icon-remove-close"></span></a>
<div class="context-title">Switch branches/tags</div>
<div class="context-body pane-selector commitish-selector js-navigation-container">
<div class="filterbar">
<input type="text" id="context-commitish-filter-field" class="js-navigation-enable" placeholder="Filter branches/tags" data-filterable />
<ul class="tabs">
<li><a href="#" data-filter="branches" class="selected">Branches</a></li>
<li><a href="#" data-filter="tags">Tags</a></li>
</ul>
</div>
<div class="js-filter-tab js-filter-branches" data-filterable-for="context-commitish-filter-field" data-filterable-type=substring>
<div class="no-results js-not-filterable">Nothing to show</div>
<div class="commitish-item branch-commitish selector-item js-navigation-item js-navigation-target selected">
<span class="mini-icon mini-icon-confirm"></span>
<h4>
<a href="/andreassolberg/DiscoJuice/blob/master/docs/discoreadwrite.txt" class="js-navigation-open" data-name="master" rel="nofollow">master</a>
</h4>
</div>
<div class="commitish-item branch-commitish selector-item js-navigation-item js-navigation-target ">
<span class="mini-icon mini-icon-confirm"></span>
<h4>
<a href="/andreassolberg/DiscoJuice/blob/v1/docs/discoreadwrite.txt" class="js-navigation-open" data-name="v1" rel="nofollow">v1</a>
</h4>
</div>
</div>
<div class="js-filter-tab js-filter-tags" style="display:none" data-filterable-for="context-commitish-filter-field" data-filterable-type=substring>
<div class="no-results js-not-filterable">Nothing to show</div>
</div>
</div>
</div><!-- /.commitish-context-context -->
</div>
</li>
</ul>
<ul class="subnav with-scope">
<li><a href="/andreassolberg/DiscoJuice" class="selected" highlight="repo_source">Files</a></li>
<li><a href="/andreassolberg/DiscoJuice/commits/master" highlight="repo_commits">Commits</a></li>
<li><a href="/andreassolberg/DiscoJuice/branches" class="" highlight="repo_branches" rel="nofollow">Branches <span class="counter">2</span></a></li>
</ul>
</div>
</div><!-- /.repohead -->
<div id="js-repo-pjax-container" data-pjax-container>
<!-- block_view_fragment_key: views10/v8/blob:v21:bfdde1bf54903ee47aefefa0570ea2a6 -->
<div id="slider">
<div class="breadcrumb" data-path="docs/discoreadwrite.txt/">
<b itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/andreassolberg/DiscoJuice/tree/f157088df59418f584ba18aa37060ee8c44d835b" class="js-rewrite-sha" itemprop="url"><span itemprop="title">DiscoJuice</span></a></b> / <span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/andreassolberg/DiscoJuice/tree/f157088df59418f584ba18aa37060ee8c44d835b/docs" class="js-rewrite-sha" itemscope="url"><span itemprop="title">docs</span></a></span> / <strong class="final-path">discoreadwrite.txt</strong> <span class="js-clippy mini-icon mini-icon-clippy " data-clipboard-text="docs/discoreadwrite.txt" data-copied-hint="copied!" data-copy-hint="copy to clipboard"></span>
</div>
<div class="commit file-history-tease" data-path="docs/discoreadwrite.txt/">
<img class="main-avatar" height="24" src="https://secure.gravatar.com/avatar/bb0fc52e444943b79c3c4b1ecbeb5a97?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" width="24" />
<span class="author"><a href="/andreassolberg">andreassolberg</a></span>
<time class="js-relative-date" datetime="2011-09-27T06:33:56-07:00" title="2011-09-27 06:33:56">September 27, 2011</time>
<div class="commit-title">
<a href="/andreassolberg/DiscoJuice/commit/0cedf9bce33afa480c84432c28c11fc73c95aea7" class="message">Adding documentation for v1.0</a>
</div>
<div class="participation">
<p class="quickstat"><a href="#blob_contributors_box" rel="facebox"><strong>1</strong> contributor</a></p>
</div>
<div id="blob_contributors_box" style="display:none">
<h2>Users on GitHub who have contributed to this file</h2>
<ul class="facebox-user-list">
<li>
<img height="24" src="https://secure.gravatar.com/avatar/bb0fc52e444943b79c3c4b1ecbeb5a97?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" width="24" />
<a href="/andreassolberg">andreassolberg</a>
</li>
</ul>
</div>
</div>
<div class="frames">
<div class="frame frame-center" data-path="docs/discoreadwrite.txt/" data-permalink-url="/andreassolberg/DiscoJuice/blob/f157088df59418f584ba18aa37060ee8c44d835b/docs/discoreadwrite.txt" data-title="DiscoJuice/docs/discoreadwrite.txt at master · andreassolberg/DiscoJuice · GitHub" data-type="blob">
<div id="files" class="bubble">
<div class="file">
<div class="meta">
<div class="info">
<span class="icon"><b class="mini-icon mini-icon-text-file"></b></span>
<span class="mode" title="File Mode">100644</span>
<span>41 lines (24 sloc)</span>
<span>2.136 kb</span>
</div>
<ul class="button-group actions">
<li>
<a class="grouped-button file-edit-link minibutton bigger lighter js-rewrite-sha" href="/andreassolberg/DiscoJuice/edit/f157088df59418f584ba18aa37060ee8c44d835b/docs/discoreadwrite.txt" data-method="post" rel="nofollow" data-hotkey="e">Edit this file</a>
</li>
<li>
<a href="/andreassolberg/DiscoJuice/raw/master/docs/discoreadwrite.txt" class="minibutton btn-raw grouped-button bigger lighter" id="raw-url">Raw</a>
</li>
<li>
<a href="/andreassolberg/DiscoJuice/blame/master/docs/discoreadwrite.txt" class="minibutton btn-blame grouped-button bigger lighter">Blame</a>
</li>
<li>
<a href="/andreassolberg/DiscoJuice/commits/master/docs/discoreadwrite.txt" class="minibutton btn-history grouped-button bigger lighter" rel="nofollow">History</a>
</li>
</ul>
</div>
<div class="data type-text">
<table cellpadding="0" cellspacing="0" class="lines">
<tr>
<td>
<pre class="line_numbers"><span id="L1" rel="#L1">1</span>
<span id="L2" rel="#L2">2</span>
<span id="L3" rel="#L3">3</span>
<span id="L4" rel="#L4">4</span>
<span id="L5" rel="#L5">5</span>
<span id="L6" rel="#L6">6</span>
<span id="L7" rel="#L7">7</span>
<span id="L8" rel="#L8">8</span>
<span id="L9" rel="#L9">9</span>
<span id="L10" rel="#L10">10</span>
<span id="L11" rel="#L11">11</span>
<span id="L12" rel="#L12">12</span>
<span id="L13" rel="#L13">13</span>
<span id="L14" rel="#L14">14</span>
<span id="L15" rel="#L15">15</span>
<span id="L16" rel="#L16">16</span>
<span id="L17" rel="#L17">17</span>
<span id="L18" rel="#L18">18</span>
<span id="L19" rel="#L19">19</span>
<span id="L20" rel="#L20">20</span>
<span id="L21" rel="#L21">21</span>
<span id="L22" rel="#L22">22</span>
<span id="L23" rel="#L23">23</span>
<span id="L24" rel="#L24">24</span>
<span id="L25" rel="#L25">25</span>
<span id="L26" rel="#L26">26</span>
<span id="L27" rel="#L27">27</span>
<span id="L28" rel="#L28">28</span>
<span id="L29" rel="#L29">29</span>
<span id="L30" rel="#L30">30</span>
<span id="L31" rel="#L31">31</span>
<span id="L32" rel="#L32">32</span>
<span id="L33" rel="#L33">33</span>
<span id="L34" rel="#L34">34</span>
<span id="L35" rel="#L35">35</span>
<span id="L36" rel="#L36">36</span>
<span id="L37" rel="#L37">37</span>
<span id="L38" rel="#L38">38</span>
<span id="L39" rel="#L39">39</span>
<span id="L40" rel="#L40">40</span>
</pre>
</td>
<td width="100%">
<div class="highlight"><pre><div class='line' id='LC1'># DiscoReadWrite Protocol</div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'>The DiscoReadWrite protocol is a simple extension to *[Identity Provider Discovery Service Protocol and Profile](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-idp-discovery.pdf)*.</div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>The protocol is backward compatible with *Identity Provider Discovery Service Protocol and Profile*, meaning that it adds some functionality (which will be ignored by disovery services that supports this profile and not the DiscoReadWrite protocol).</div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'>The extension includes two new elements:</div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'>* allowing a provider to *write the result of preferred provider*, and</div><div class='line' id='LC10'>* allowing a new parameter `auth` that may distinguish saml authentication from other authentication methods.</div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'>## The Request</div><div class='line' id='LC13'><br/></div><div class='line' id='LC14'>entityID</div><div class='line' id='LC15'>: REQUIRED. The unique identifier of the service provider the end user is (or will be) interacting with, following successful authentication by an identity provider.</div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'>return</div><div class='line' id='LC18'>: The URL in which to return the result.</div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'>policy</div><div class='line' id='LC21'>: Described in *Identity Provider Discovery Service Protocol and Profile*.</div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'>returnIDParam</div><div class='line' id='LC24'>: A parameter name used to return the unique identifier of the selected identity provider to the original requester. If this parameter is omitted, it defaults to a value of &quot;`entityID`&quot;.</div><div class='line' id='LC25'><br/></div><div class='line' id='LC26'>isPassive</div><div class='line' id='LC27'>: A boolean value of &quot;`true`&quot; or &quot;`false`&quot; that controls whether the discovery service is allowed to visibly interact with the user agent in the second step below. If a value is not provided, the default is &quot;`false`&quot;. In DiscoJuice this value is always set to `true`.</div><div class='line' id='LC28'><br/></div><div class='line' id='LC29'>IdPentityID</div><div class='line' id='LC30'>: **NEW**. If the client that sends the request already knows what provider the user has selected. The reason why the DiscoReadWrite protocol is used in this context is not to ask the server what is the preferred provider, but to tell what it is. Then the server may store that value in a central cookie, and other services may benefit from learning about this.</div><div class='line' id='LC31'><br/></div><div class='line' id='LC32'>## The Response</div><div class='line' id='LC33'><br/></div><div class='line' id='LC34'>entityID</div><div class='line' id='LC35'>: The SAML entityID of the login provider. Or unique ID if authentication protocol is not SAML.</div><div class='line' id='LC36'><br/></div><div class='line' id='LC37'>auth</div><div class='line' id='LC38'>: **NEW**. The authentication protocol supported by the login provider. Default is `saml`. May be `twitter`, `facebook` or other.</div><div class='line' id='LC39'><br/></div><div class='line' id='LC40'><br/></div></pre></div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="frame frame-loading large-loading-area" style="display:none;" data-tree-list-url="/andreassolberg/DiscoJuice/tree-list/f157088df59418f584ba18aa37060ee8c44d835b" data-blob-url-prefix="/andreassolberg/DiscoJuice/blob/f157088df59418f584ba18aa37060ee8c44d835b">
<img src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-64.gif?1329872008" height="64" width="64">
</div>
</div>
</div>
<div class="context-overlay"></div>
</div>
<div id="footer-push"></div><!-- hack for sticky footer -->
</div><!-- end of wrapper - hack for sticky footer -->
<!-- footer -->
<div id="footer" >
<div class="upper_footer">
<div class="container clearfix">
<!--[if IE]><h4 id="blacktocat_ie">GitHub Links</h4><![endif]-->
<![if !IE]><h4 id="blacktocat">GitHub Links</h4><![endif]>
<ul class="footer_nav">
<h4>GitHub</h4>
<li><a href="https://github.com/about">About</a></li>
<li><a href="https://github.com/blog">Blog</a></li>
<li><a href="https://github.com/features">Features</a></li>
<li><a href="https://github.com/contact">Contact &amp; Support</a></li>
<li><a href="https://github.com/training">Training</a></li>
<li><a href="http://enterprise.github.com/">GitHub Enterprise</a></li>
<li><a href="http://status.github.com/">Site Status</a></li>
</ul>
<ul class="footer_nav">
<h4>Clients</h4>
<li><a href="http://mac.github.com/">GitHub for Mac</a></li>
<li><a href="http://windows.github.com/">GitHub for Windows</a></li>
<li><a href="http://eclipse.github.com/">GitHub for Eclipse</a></li>
<li><a href="http://mobile.github.com/">GitHub Mobile Apps</a></li>
</ul>
<ul class="footer_nav">
<h4>Tools</h4>
<li><a href="http://get.gaug.es/">Gauges: Web analytics</a></li>
<li><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></li>
<li><a href="https://gist.github.com">Gist: Code snippets</a></li>
<h4 class="second">Extras</h4>
<li><a href="http://jobs.github.com/">Job Board</a></li>
<li><a href="http://shop.github.com/">GitHub Shop</a></li>
<li><a href="http://octodex.github.com/">The Octodex</a></li>
</ul>
<ul class="footer_nav">
<h4>Documentation</h4>
<li><a href="http://help.github.com/">GitHub Help</a></li>
<li><a href="http://developer.github.com/">Developer API</a></li>
<li><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></li>
<li><a href="http://pages.github.com/">GitHub Pages</a></li>
</ul>
</div><!-- /.site -->
</div><!-- /.upper_footer -->
<div class="lower_footer">
<div class="container clearfix">
<!--[if IE]><div id="legal_ie"><![endif]-->
<![if !IE]><div id="legal"><![endif]>
<ul>
<li><a href="https://github.com/site/terms">Terms of Service</a></li>
<li><a href="https://github.com/site/privacy">Privacy</a></li>
<li><a href="https://github.com/security">Security</a></li>
</ul>
<p>&copy; 2012 <span title="0.13573s from fe4.rs.github.com">GitHub</span> Inc. All rights reserved.</p>
</div><!-- /#legal or /#legal_ie-->
<div class="sponsor">
<a href="http://www.rackspace.com" class="logo">
<img alt="Dedicated Server" height="36" src="https://a248.e.akamai.net/assets.github.com/images/modules/footer/rackspaces_logo.png?1329521040" width="38" />
</a>
Powered by the <a href="http://www.rackspace.com ">Dedicated
Servers</a> and<br/> <a href="http://www.rackspacecloud.com">Cloud
Computing</a> of Rackspace Hosting<span>&reg;</span>
</div>
</div><!-- /.site -->
</div><!-- /.lower_footer -->
</div><!-- /#footer -->
<div id="keyboard_shortcuts_pane" class="instapaper_ignore readability-extra" style="display:none">
<h2>Keyboard Shortcuts <small><a href="#" class="js-see-all-keyboard-shortcuts">(see all)</a></small></h2>
<div class="columns threecols">
<div class="column first">
<h3>Site wide shortcuts</h3>
<dl class="keyboard-mappings">
<dt>s</dt>
<dd>Focus site search</dd>
</dl>
<dl class="keyboard-mappings">
<dt>?</dt>
<dd>Bring up this help dialog</dd>
</dl>
</div><!-- /.column.first -->
<div class="column middle" style='display:none'>
<h3>Commit list</h3>
<dl class="keyboard-mappings">
<dt>j</dt>
<dd>Move selection down</dd>
</dl>
<dl class="keyboard-mappings">
<dt>k</dt>
<dd>Move selection up</dd>
</dl>
<dl class="keyboard-mappings">
<dt>c <em>or</em> o <em>or</em> enter</dt>
<dd>Open commit</dd>
</dl>
<dl class="keyboard-mappings">
<dt>y</dt>
<dd>Expand URL to its canonical form</dd>
</dl>
</div><!-- /.column.first -->
<div class="column last" style='display:none'>
<h3>Pull request list</h3>
<dl class="keyboard-mappings">
<dt>j</dt>
<dd>Move selection down</dd>
</dl>
<dl class="keyboard-mappings">
<dt>k</dt>
<dd>Move selection up</dd>
</dl>
<dl class="keyboard-mappings">
<dt>o <em>or</em> enter</dt>
<dd>Open issue</dd>
</dl>
<dl class="keyboard-mappings">
<dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> enter</dt>
<dd>Submit comment</dd>
</dl>
</div><!-- /.columns.last -->
</div><!-- /.columns.equacols -->
<div style='display:none'>
<div class="rule"></div>
<h3>Issues</h3>
<div class="columns threecols">
<div class="column first">
<dl class="keyboard-mappings">
<dt>j</dt>
<dd>Move selection down</dd>
</dl>
<dl class="keyboard-mappings">
<dt>k</dt>
<dd>Move selection up</dd>
</dl>
<dl class="keyboard-mappings">
<dt>x</dt>
<dd>Toggle selection</dd>
</dl>
<dl class="keyboard-mappings">
<dt>o <em>or</em> enter</dt>
<dd>Open issue</dd>
</dl>
<dl class="keyboard-mappings">
<dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> enter</dt>
<dd>Submit comment</dd>
</dl>
</div><!-- /.column.first -->
<div class="column last">
<dl class="keyboard-mappings">
<dt>c</dt>
<dd>Create issue</dd>
</dl>
<dl class="keyboard-mappings">
<dt>l</dt>
<dd>Create label</dd>
</dl>
<dl class="keyboard-mappings">
<dt>i</dt>
<dd>Back to inbox</dd>
</dl>
<dl class="keyboard-mappings">
<dt>u</dt>
<dd>Back to issues</dd>
</dl>
<dl class="keyboard-mappings">
<dt>/</dt>
<dd>Focus issues search</dd>
</dl>
</div>
</div>
</div>
<div style='display:none'>
<div class="rule"></div>
<h3>Issues Dashboard</h3>
<div class="columns threecols">
<div class="column first">
<dl class="keyboard-mappings">
<dt>j</dt>
<dd>Move selection down</dd>
</dl>
<dl class="keyboard-mappings">
<dt>k</dt>
<dd>Move selection up</dd>
</dl>
<dl class="keyboard-mappings">
<dt>o <em>or</em> enter</dt>
<dd>Open issue</dd>
</dl>
</div><!-- /.column.first -->
</div>
</div>
<div style='display:none'>
<div class="rule"></div>
<h3>Network Graph</h3>
<div class="columns equacols">
<div class="column first">
<dl class="keyboard-mappings">
<dt><span class="badmono">←</span> <em>or</em> h</dt>
<dd>Scroll left</dd>
</dl>
<dl class="keyboard-mappings">
<dt><span class="badmono">→</span> <em>or</em> l</dt>
<dd>Scroll right</dd>
</dl>
<dl class="keyboard-mappings">
<dt><span class="badmono">↑</span> <em>or</em> k</dt>
<dd>Scroll up</dd>
</dl>
<dl class="keyboard-mappings">
<dt><span class="badmono">↓</span> <em>or</em> j</dt>
<dd>Scroll down</dd>
</dl>
<dl class="keyboard-mappings">
<dt>t</dt>
<dd>Toggle visibility of head labels</dd>
</dl>
</div><!-- /.column.first -->
<div class="column last">
<dl class="keyboard-mappings">
<dt>shift <span class="badmono">←</span> <em>or</em> shift h</dt>
<dd>Scroll all the way left</dd>
</dl>
<dl class="keyboard-mappings">
<dt>shift <span class="badmono">→</span> <em>or</em> shift l</dt>
<dd>Scroll all the way right</dd>
</dl>
<dl class="keyboard-mappings">
<dt>shift <span class="badmono">↑</span> <em>or</em> shift k</dt>
<dd>Scroll all the way up</dd>
</dl>
<dl class="keyboard-mappings">
<dt>shift <span class="badmono">↓</span> <em>or</em> shift j</dt>
<dd>Scroll all the way down</dd>
</dl>
</div><!-- /.column.last -->
</div>
</div>
<div >
<div class="rule"></div>
<div class="columns threecols">
<div class="column first" >
<h3>Source Code Browsing</h3>
<dl class="keyboard-mappings">
<dt>t</dt>
<dd>Activates the file finder</dd>
</dl>
<dl class="keyboard-mappings">
<dt>l</dt>
<dd>Jump to line</dd>
</dl>
<dl class="keyboard-mappings">
<dt>w</dt>
<dd>Switch branch/tag</dd>
</dl>
<dl class="keyboard-mappings">
<dt>y</dt>
<dd>Expand URL to its canonical form</dd>
</dl>
</div>
</div>
</div>
<div style='display:none'>
<div class="rule"></div>
<div class="columns threecols">
<div class="column first">
<h3>Browsing Commits</h3>
<dl class="keyboard-mappings">
<dt><span class="platform-mac">⌘</span><span class="platform-other">ctrl</span> <em>+</em> enter</dt>
<dd>Submit comment</dd>
</dl>
<dl class="keyboard-mappings">
<dt>escape</dt>
<dd>Close form</dd>
</dl>
<dl class="keyboard-mappings">
<dt>p</dt>
<dd>Parent commit</dd>
</dl>
<dl class="keyboard-mappings">
<dt>o</dt>
<dd>Other parent commit</dd>
</dl>
</div>
</div>
</div>
</div>
<div id="markdown-help" class="instapaper_ignore readability-extra">
<h2>Markdown Cheat Sheet</h2>
<div class="cheatsheet-content">
<div class="mod">
<div class="col">
<h3>Format Text</h3>
<p>Headers</p>
<pre>
# This is an &lt;h1&gt; tag
## This is an &lt;h2&gt; tag
###### This is an &lt;h6&gt; tag</pre>
<p>Text styles</p>
<pre>
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
*You **can** combine them*
</pre>
</div>
<div class="col">
<h3>Lists</h3>
<p>Unordered</p>
<pre>
* Item 1
* Item 2
* Item 2a
* Item 2b</pre>
<p>Ordered</p>
<pre>
1. Item 1
2. Item 2
3. Item 3
* Item 3a
* Item 3b</pre>
</div>
<div class="col">
<h3>Miscellaneous</h3>
<p>Images</p>
<pre>
![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)
</pre>
<p>Links</p>
<pre>
http://github.com - automatic!
[GitHub](http://github.com)</pre>
<p>Blockquotes</p>
<pre>
As Kanye West said:
> We're living the future so
> the present is our past.
</pre>
</div>
</div>
<div class="rule"></div>
<h3>Code Examples in Markdown</h3>
<div class="col">
<p>Syntax highlighting with <a href="http://github.github.com/github-flavored-markdown/" title="GitHub Flavored Markdown" target="_blank">GFM</a></p>
<pre>
```javascript
function fancyAlert(arg) {
if(arg) {
$.facebox({div:'#foo'})
}
}
```</pre>
</div>
<div class="col">
<p>Or, indent your code 4 spaces</p>
<pre>
Here is a Python code example
without syntax highlighting:
def foo:
if not bar:
return true</pre>
</div>
<div class="col">
<p>Inline code for comments</p>
<pre>
I think you should use an
`&lt;addr&gt;` element here instead.</pre>
</div>
</div>
</div>
</div>
<div id="ajax-error-message">
<span class="mini-icon mini-icon-exclamation"></span>
Something went wrong with that request. Please try again.
<a href="#" class="ajax-error-dismiss">Dismiss</a>
</div>
<div id="logo-popup">
<h2>Looking for the GitHub logo?</h2>
<ul>
<li>
<h4>GitHub Logo</h4>
<a href="http://github-media-downloads.s3.amazonaws.com/GitHub_Logos.zip"><img alt="Github_logo" src="https://a248.e.akamai.net/assets.github.com/images/modules/about_page/github_logo.png?1306884373" /></a>
<a href="http://github-media-downloads.s3.amazonaws.com/GitHub_Logos.zip" class="minibutton btn-download download">Download</a>
</li>
<li>
<h4>The Octocat</h4>
<a href="http://github-media-downloads.s3.amazonaws.com/Octocats.zip"><img alt="Octocat" src="https://a248.e.akamai.net/assets.github.com/images/modules/about_page/octocat.png?1306884373" /></a>
<a href="http://github-media-downloads.s3.amazonaws.com/Octocats.zip" class="minibutton btn-download download">Download</a>
</li>
</ul>
</div>
<span id='server_response_time' data-time='0.20661' data-host='fe4'></span>
</body>
</html>

Binary file not shown.

4
jquery-1.7.2.min.js vendored Executable file

File diff suppressed because one or more lines are too long

61
jquery.cookie-1.1.js Normal file
View File

@ -0,0 +1,61 @@
/*jshint eqnull:true */
/*!
* jQuery Cookie Plugin v1.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2011, Klaus Hartl
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*/
(function($, document) {
var pluses = /\+/g;
function raw(s) {
return s;
}
function decoded(s) {
return decodeURIComponent(s.replace(pluses, ' '));
}
$.cookie = function(key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value == null)) {
options = $.extend({}, $.cookie.defaults, options);
if (value == null) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || $.cookie.defaults || {};
var decode = options.raw ? raw : decoded;
var cookies = document.cookie.split('; ');
for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) {
if (decode(parts.shift()) === key) {
return decode(parts.join('='));
}
}
return null;
};
$.cookie.defaults = {};
})(jQuery, document);

19
jquery.qs.js Normal file
View File

@ -0,0 +1,19 @@
/* Copied from http://paulgueller.com/2011/04/26/parse-the-querystring-with-jquery/
* Modification: added decoding of parameters value using unescape()
* Usage:
* var qs = jQuery.parseQuerystring();
* //qs['foo'] == "bar"
* //qs.somevalue == "myvalue"
*/
jQuery.extend({
parseQuerystring: function(){
var nvpair = {};
var qs = window.location.search.replace('?', '');
var pairs = qs.split('&');
$.each(pairs, function(i, v){
var pair = v.split('=');
nvpair[pair[0]] = unescape(pair[1]);
});
return nvpair;
}
});

24
response.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.cookie-1.1.js"></script>
<script type="text/javascript" src="jquery.qs.js"></script>
<script type="text/javascript" src="debug.js"></script>
</head>
<body>
<script>
var C_ENTITY_ID = "entityID";
var C_AUTH = "auth";
var qs = $.parseQuerystring();
var auth = qs[C_AUTH];
var entity_id = qs[C_ENTITY_ID];
debug_alert(window.location.search + ' received ' + entity_id + ' + auth ' + auth);
if (entity_id && parent.disco_callback) {
parent.disco_callback(entity_id, auth);
}
</script>
</body>
</html>

52
store.html Normal file
View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.cookie-1.1.js"></script>
<script type="text/javascript" src="jquery.qs.js"></script>
<script type="text/javascript" src="debug.js"></script>
</head>
<body>
<script>
var C_ENTITY_ID = "entityID";
var C_RETURN = "return";
var C_POLICY = "policy";
var C_RETURNIDPARAM = "returnIDParam";
var C_IS_PASSIVE = "isPassive";
var C_IDP_ENTITY_ID = "IdPentityID";
var COOKIE_TIMEOUT_DAYS = 730;
var qs = $.parseQuerystring();
var entity_id = qs[C_ENTITY_ID];
var return_url = qs[C_RETURN];
var return_id_param = C_ENTITY_ID;
if (C_RETURNIDPARAM in qs) {
return_id_param = qs[C_RETURNIDPARAM];
}
var idp_entity_id = undefined;
if (C_IDP_ENTITY_ID in qs) {
idp_entity_id = qs[C_IDP_ENTITY_ID];
debug_alert('set idp to ' + idp_entity_id);
$.cookie(C_IDP_ENTITY_ID, qs[C_IDP_ENTITY_ID], { expires: COOKIE_TIMEOUT_DAYS });
} else {
idp_entity_id = $.cookie(C_IDP_ENTITY_ID);
}
function response() {
debug_alert('query by ' + entity_id);
if (idp_entity_id) {
$.cookie(C_IDP_ENTITY_ID, qs[C_IDP_ENTITY_ID], { expires: COOKIE_TIMEOUT_DAYS });
if (return_url.indexOf('?') == -1) {
return_url = return_url + '?';
} else {
return_url = return_url + '&';
}
return_url = return_url + return_id_param + '=' + escape(idp_entity_id);
}
debug_alert('returning to ' + return_url);
window.location.href = return_url;
}
response();
</script>
</body>
</html>

27
test.html Normal file
View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.qs.js"></script>
<script type="text/javascript" src="discoquery.js"></script>
<script type="text/javascript" src="debug.js"></script>
</head>
<body>
<script>
function query() {
$.disco_query("coucou", "http://localhost/~bdauvergne/discostore/store.html", "http://localhost/~bdauvergne/discostore/response.html", function (entity_id, auth) {
alert("idp is " + entity_id); });
}
function set() {
$.disco_set("coucou", $('#idp').val(), "http://localhost/~bdauvergne/discostore/store.html", "http://localhost/~bdauvergne/discostore/response.html", function (entity_id, auth) {
alert("idp has been set to " + entity_id); });
}
</script>
<div>
<button onclick="query()">Query</button>
</div>
<div>
<label>IdP</label><input type="text" id="idp"></input>
<button onclick="set()">Set</button>
</body>
<html>