How to use the openid.ns function in openid

To help you get started, we’ve selected a few openid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github havard / node-openid / openid.js View on Github external
var _verifyDiscoveredInformation = function(params, stateless, extensions, strict, callback)
{
  var claimedIdentifier = params['openid.claimed_id'];
  var useLocalIdentifierAsKey = false;
  if(!_isDef(claimedIdentifier))
  {
    if(!_isDef(params['openid.ns']))
    {
      // OpenID 1.0/1.1 response without a claimed identifier
      // We need to load discovered information using the
      // local identifier
      useLocalIdentifierAsKey = true;
    }
    else {
      // OpenID 2.0+:
      // If there is no claimed identifier, then the
      // assertion is not about an identity
      return callback(null, { authenticated: false }); 
      }
  }

  if (useLocalIdentifierAsKey) {
    claimedIdentifier = params['openid.identity'];
github charliecalvert / JsObjects / JavaScript / Authenticate / OpenId02 / server01.js View on Github external
relyingParty.verifyAssertion(request, function(error, result) {
        var isGood = !error &amp;&amp; result.authenticated ? '<h1>Success!</h1>' : '<h1>Failed</h1>';
        res.writeHead(200, {
            'Content-Type': 'text/html'
        });
        res.write(isGood);
        res.write('<p>' + query['openid.assoc_handle'] + '</p>');
        res.write('<p>' + query['openid.claimed_id'] + '</p>');
        res.write('<p>' + query['openid.identity'] + '</p>');
        res.write('<p>' + query['openid.mode'] + '</p>');
        res.write('<p>' + query['openid.ns'] + '</p>');
        res.write('<p>' + query['openid.op_endpoint'] + '</p>');
        res.write('<p>' + query['openid.response_nonce'] + '</p>');
        res.write('<p>' + query['openid.return_to'] + '</p>');
        res.write('<p>' + query['openid.sig'] + '</p>');
        res.write('<p>' + query['openid.signed'] + '</p>');
        res.end('bye');
    });
});
github havard / node-openid / openid.js View on Github external
var _verifyAssertionAgainstProviders = function(providers, params, stateless, extensions, callback)
{
  for(var i = 0; i &lt; providers.length; ++i)
  {
    var provider = providers[i];
    if(!!params['openid.ns'] &amp;&amp; (!provider.version || provider.version.indexOf(params['openid.ns']) !== 0))
    {
      continue;
    }

    if(!!provider.version &amp;&amp; provider.version.indexOf('2.0') !== -1)
    {
      var endpoint = params['openid.op_endpoint'];
      if (provider.endpoint != endpoint) 
      {
        continue;
      }
      if(provider.claimedIdentifier) {
        var claimedIdentifier = _getCanonicalClaimedIdentifier(params['openid.claimed_id']);
        if(provider.claimedIdentifier != claimedIdentifier) {
          return callback({ message: 'Claimed identifier in assertion response does not match discovered claimed identifier' });
        }
github havard / node-openid / openid.js View on Github external
var _requestAuthentication = function(provider, assoc_handle, returnUrl, realm, immediate, extensions, callback)
{
  var params = {
    'openid.mode' : immediate ? 'checkid_immediate' : 'checkid_setup'
  };

  if(provider.version.indexOf('2.0') !== -1)
  {
    params['openid.ns'] = 'http://specs.openid.net/auth/2.0';
  }

  for (var i in extensions)
  {
    if(!hasOwnProperty(extensions, i))
    {
      continue;
    }

    var extension = extensions[i];
    for (var key in extension.requestParams)
    {
      if (!hasOwnProperty(extension.requestParams, key)) { continue; }
      params[key] = extension.requestParams[key];
    }
  }