Skip to content

Discovery Service

Leif Johansson edited this page Apr 19, 2019 · 14 revisions

This page describes the current discovery service in pyFF which is being deprecated as of version 1.0.0

For information/preview about the recommended replacement cf TheIdentitySelector project.


There are 3 ways to integrate with the discovery service in pyFF:

  1. Use the SAML identity provider discovery protocol.
  2. Use the jquery discovery widget and provide your own HTML
  3. Use the discovery service client and provide both your own HTML and javascript

jquery discovery widget

Sample HTML:

<div id="ds"
     data-href="sp entity id"
     data-mdq="mdq server base URL"
     data-store="pyff instance /storage URL"
     data-search="pyff instance search URL"
     data-list="an optional URL returning a list"
     data-related="a hint domain"
     data-inputfieldselector="#searchinput">
     <div class="form-group">
        <div class="input-group">
           <input id="searchinput" class="form-control" type="search"/>
        </div>
     </div>
</div>

Next include the following dependencies:

<script type="text/javascript" src="<base URL>/static/js/client.min.js"></script>
<script type="text/javascript" src="<base URL>/static/js/ds-client.js"></script>
<script type="text/javascript" src="<base URL>/static/js/jquery-ds-widget.js"></script>

and then use this javascript to activate the discovery client

$(document).ready(function() {
   $("#ds").discovery_client(options);
});

There are a few options that you can set:

  • before: function(entities) - a function called with the list of entities before it is rendered. If you modify the list of entities you must return the list.
  • after: function(count) - a function called with the number of entities rendered. This can be used to optionally render a search-box if the count == 0
  • render: function(entity) - return html to be rendered for the entity.

It is in fact trivial to implement your own SAML discovery service based on this HTML+js template.

Example using nightly.pyff.io

In order to use this on your own SP using the nightly.pyff.io instance you might include something like this:

<html>
<head>
...
<script type="text/javascript" src="https://nightly.pyff.io/static/js/client.min.js"></script>
<script type="text/javascript" src="https://nightly.pyff.io/static/js/ds-client.js"></script>
<script type="text/javascript" src="https://nightly.pyff.io/static/js/jquery-ds-widget.js"></script>
</head>

<body>
...
<div id="ds"
     data-href="sp entity id"
     data-mdq="https://nightly.pyff.io"
     data-store="https://nightly.pyff.io/storage/"
     data-inputfieldselector="#searchinput">
     <div class="form-group">
        <div class="input-group">
           <input id="searchinput" class="form-control" type="search"/>
        </div>
     </div>
</div>
</body>
</html>

Future development

The pyFF discovery service is a moving target. Here are some of the issues that will (have to be) addressed in the near future:

  • refactor lowlevel ds-client from storage-oriented API to cross-domain API using krakenjs
  • use websockets as fallback
  • extend jquery widget to support more list mechanisms
You can’t perform that action at this time.