<commit_before>/**
 * Module dependencies.
 */
var webfinger = require('webfinger').webfinger
  , configuration = require('../configuration').configuration;


/**
 * Discover OpenID Connect provider configuration using WebFinger.
 *
 * This discovery mechanism uses WebFinger to discover the issuer for a
 * user-supplied identifier.  Once the issuer is known, it's configuration is
 * loaded.
 *
 * Note: Prior to draft 12, OpenID Connect Discovery used Simple Web Discovery
 *       rather than WebFinger.  At the time of writing, many provider
 *       implementations continue to implement SWD.
 *
 * References:
 *   - [OpenID Connect Discovery 1.0 - draft 12](http://openid.net/specs/openid-connect-discovery-1_0.html)
 *   - [WebFinger](http://tools.ietf.org/html/draft-ietf-appsawg-webfinger-10)
 *
 * @return {Function}
 * @api public
 */
module.exports = function() {
  
  return function(identifier, done) {
    if (!identifier) { return done(); }
    
    webfinger(identifier, 'http://openid.net/specs/connect/1.0/issuer', function(err, jrd) {
      if (err) { return done(err); };
      
      console.log('JRD:');
      console.log(jrd);
      
      var issuer;
      for (var i = 0; i < jrd.links.length; i++) {
        var link = jrd.links[i];
        if (link.rel == 'http://openid.net/specs/connect/1.0/issuer') {
          issuer = link.href;
          break;
        }
      }
      
      if (!issuer) { return done(new Error('No OpenID Connect issuer found in resource descriptor')); }<commit_msg>Disable hostmeta fallback when using WebFinger discovery.<commit_after>/**
 * Module dependencies.
 */
var webfinger = require('webfinger').webfinger
  , configuration = require('../configuration').configuration;


/**
 * Discover OpenID Connect provider configuration using WebFinger.
 *
 * This discovery mechanism uses WebFinger to discover the issuer for a
 * user-supplied identifier.  Once the issuer is known, it's configuration is
 * loaded.
 *
 * Note: Prior to draft 12, OpenID Connect Discovery used Simple Web Discovery
 *       rather than WebFinger.  At the time of writing, many provider
 *       implementations continue to implement SWD.
 *
 * References:
 *   - [OpenID Connect Discovery 1.0 - draft 12](http://openid.net/specs/openid-connect-discovery-1_0.html)
 *   - [WebFinger](http://tools.ietf.org/html/draft-ietf-appsawg-webfinger-10)
 *
 * @return {Function}
 * @api public
 */
module.exports = function() {
  
  return function(identifier, done) {
    if (!identifier) { return done(); }
    
    webfinger(identifier, 'http://openid.net/specs/connect/1.0/issuer', { webfingerOnly: true }, function(err, jrd) {
      if (err) { return done(err); };
      
      console.log('JRD:');
      console.log(jrd);
      
      var issuer;
      for (var i = 0; i < jrd.links.length; i++) {
        var link = jrd.links[i];
        if (link.rel == 'http://openid.net/specs/connect/1.0/issuer') {
          issuer = link.href;
          break;
        }
      }
      
      if (!issuer) { return done(new Error('No OpenID Connect issuer found in resource descriptor')); }
{'fraction_non_alphanumeric': 0.13211186113789777, 'fraction_numerical': 0.009643201542912247, 'mean_word_length': 2.8514851485148514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7525399', 'n_tokens_mistral': 979, 'n_tokens_neox': 950, 'n_words': 258}