Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'http://specs.openid.net/auth/2.0/identifier_select';
}
else {
return callback({ message: 'OpenID 1.0/1.1 provider cannot be used without a claimed identifier' });
}
if(assoc_handle)
{
params['openid.assoc_handle'] = assoc_handle;
}
if(returnUrl)
{
// Value should be missing if RP does not want
// user to be sent back
params['openid.return_to'] = returnUrl;
}
if(realm)
{
if(provider.version.indexOf('2.0') !== -1) {
params['openid.realm'] = realm;
}
else {
params['openid.trust_root'] = realm;
}
}
else if(!returnUrl)
{
return callback({ message: 'No return URL or realm specified' });
}
var _verifyReturnUrl = function (assertionUrl, originalReturnUrl) {
var receivedReturnUrl = assertionUrl.query['openid.return_to'];
if (!_isDef(receivedReturnUrl)) {
return false;
}
receivedReturnUrl = url.parse(receivedReturnUrl, true);
if (!receivedReturnUrl) {
return false;
}
originalReturnUrl = url.parse(originalReturnUrl, true);
if (!originalReturnUrl) {
return false;
}
if (originalReturnUrl.protocol !== receivedReturnUrl.protocol || // Verify scheme against original return URL
originalReturnUrl.host !== receivedReturnUrl.host || // Verify authority against original return URL
originalReturnUrl.pathname !== receivedReturnUrl.pathname) { // Verify path against current request URL
'http://specs.openid.net/auth/2.0/identifier_select';
}
else {
return callback({ message: 'OpenID 1.0/1.1 provider cannot be used without a claimed identifier' });
}
if(assoc_handle)
{
params['openid.assoc_handle'] = assoc_handle;
}
if(returnUrl)
{
// Value should be missing if RP does not want
// user to be sent back
params['openid.return_to'] = returnUrl;
}
if(realm)
{
if(provider.version.indexOf('2.0') !== -1) {
params['openid.realm'] = realm;
}
else {
params['openid.trust_root'] = realm;
}
}
else if(!returnUrl)
{
return callback({ message: 'No return URL or realm specified' });
}
relyingParty.verifyAssertion(request, function(error, result) {
var isGood = !error && 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');
});
});