How to use the openid.sig 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 openlink / virtuoso-opensource / appsrc / ODS-Framework / login.js View on Github external
function lfOpenIdLoginURL(uriParams) {
  var openIdServer       = uriParams['oid-srv'];
  var openIdSig          = uriParams['openid.sig'];
  var openIdIdentity     = uriParams['openid.identity'];
  var openIdAssoc_handle = uriParams['openid.assoc_handle'];
  var openIdSigned       = uriParams['openid.signed'];

  var url = openIdServer + ((openIdServer.lastIndexOf('?') != -1)? '&': '?') +
    'openid.mode=check_authentication' +
    '&openid.assoc_handle=' + encodeURIComponent (openIdAssoc_handle) +
    '&openid.sig='          + encodeURIComponent (openIdSig) +
    '&openid.signed='       + encodeURIComponent (openIdSigned);

  var sig = openIdSigned.split(',');
  for (var i = 0; i < sig.length; i++)
  {
    var _key = sig[i].trim ();
    if (_key != 'mode' &&
        _key != 'signed' &&
github CodeArtemis / TriggerRally / server / node_modules / passport-google / node_modules / passport-openid / node_modules / openid / openid.js View on Github external
for(var i = 0; i < signedParams.length; i++)
    {
      var param = signedParams[i];
      var value = params['openid.' + param];
      if(!_isDef(value))
      {
        return callback({ message: 'At least one parameter referred in signature is not present in response' }, { authenticated: false });
      }
      message += param + ':' + value + '\n';
    }

    var hmac = crypto.createHmac(association.type, _fromBase64(association.secret));
    hmac.update(message, 'utf8');
    var ourSignature = hmac.digest('base64');

    if(ourSignature == params['openid.sig'])
    {
      callback(null, { authenticated: true, claimedIdentifier: association.provider.version.indexOf('2.0') !== -1 ? params['openid.claimed_id'] : association.provider.claimedIdentifier });
    }
    else
    {
      callback({ message: 'Invalid signature' }, { authenticated: false });
    }
  });
}
github havard / node-openid / openid.js View on Github external
for(var i = 0; i < signedParams.length; i++)
    {
      var param = signedParams[i];
      var value = params['openid.' + param];
      if(!_isDef(value))
      {
        return callback({ message: 'At least one parameter referred in signature is not present in response' }, { authenticated: false });
      }
      message += param + ':' + value + '\n';
    }

    var hmac = crypto.createHmac(association.type, _buffer(association.secret, 'base64'));
    hmac.update(message, 'utf8');
    var ourSignature = hmac.digest('base64');

    if(ourSignature == params['openid.sig'])
    {
      callback(null, { authenticated: true, claimedIdentifier: association.provider.version.indexOf('2.0') !== -1 ? params['openid.claimed_id'] : association.provider.claimedIdentifier });
    }
    else
    {
      callback({ message: 'Invalid signature' }, { authenticated: false });
    }
  });
}
github sandiz / rs-manager / src / preload.js View on Github external
})
                        const sid = await window.remote.session.defaultSession.cookies.get({
                            name: 'sessionid',
                        })
                        const cookie = sls[0].value
                        const cookieSess = sid[0].value
                        authWindow.removeAllListeners('closed');
                        setImmediate(function () {
                            authWindow.close();
                        });
                        resolve({
                            response_nonce: query['openid.response_nonce'],
                            assoc_handle: query['openid.assoc_handle'],
                            identity: query['openid.identity'],
                            steam_id: query['openid.identity'].match(/\/id\/(.*$)/)[1],
                            sig: query['openid.sig'],
                            cookie,
                            cookieSess,
                        });
                    }
                }
github openlink / virtuoso-opensource / appsrc / ODS-Framework / nav_framework.js View on Github external
}
  
  
  var uriParams=OAT.Dom.uriParams();
    
  if(typeof(uriParams.sid)!='undefined' && uriParams.sid!='')
  {
    self.session.sid=uriParams.sid;
    self.session.validateSid();
  }

  
  if(!self.session.sid && typeof(uriParams['openid.signed'])!='undefined' && uriParams['openid.signed']!='')
  {
    self.session.openId.server=uriParams['oid-srv']
    self.session.openId.sig=uriParams['openid.sig'];
    self.session.openId.identity=uriParams['openid.identity']
    self.session.openId.assoc_handle=uriParams['openid.assoc_handle']
    self.session.openId.signed=uriParams['openid.signed']

    self.session.openIdVerify()
  }

  var cookieSid=this.readCookie('sid');
  if(!self.session.sid && cookieSid)
  {
    self.session.sid=cookieSid;
    self.session.validateSid();
  }
github CodeArtemis / TriggerRally / server / node_modules / passport-google / node_modules / passport-openid / node_modules / openid / openid.js View on Github external
var _checkSignature = function(params, provider, stateless, callback)
{
  if(!_isDef(params['openid.signed']) ||
    !_isDef(params['openid.sig']))
  {
    return callback({ message: 'No signature in response' }, { authenticated: false });
  }

  if(stateless)
  {
    _checkSignatureUsingProvider(params, provider, callback);
  }
  else
  {
    _checkSignatureUsingAssociation(params, callback);
  }
}
github havard / node-openid / openid.js View on Github external
var _checkSignature = function(params, provider, stateless, callback)
{
  if(!_isDef(params['openid.signed']) ||
    !_isDef(params['openid.sig']))
  {
    return callback({ message: 'No signature in response' }, { authenticated: false });
  }

  if(stateless)
  {
    _checkSignatureUsingProvider(params, provider, callback);
  }
  else
  {
    _checkSignatureUsingAssociation(params, callback);
  }
}
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');
    });
});