UNPKG

adp

Version:

Toolkit for interfacing with ADP Marketplace API's

91 lines (72 loc) 3.31 kB
var ssl = require('./ssl'), fs = require('fs'), NODE_ENV = process.env.NODE_ENV, SSL_CERT_DIR = './certs/' || '/etc/integration-portal/', sslSettings = ssl({ssl_loc: SSL_CERT_DIR}); module.exports = { // This is the path to your .key certificate file. //cert_key_path : './certs/api.key', cert_key_path : sslSettings['ENV'][NODE_ENV || 'LOCAL'].ssl_key_filename, // This is the path to your .pem certificate file. //cert_pem_path : './certs/api.pem', cert_pem_path : sslSettings['ENV'][NODE_ENV || 'LOCAL'].ssl_cert_filename, // End point for obtaining Bearer Token. //s_bearer_token_endpoint : "https://apidit.nj.adp.com/auth/oauth/v2/token", s_bearer_token_endpoint : sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_bearer_token_endpoint, // Your ADP Client ID. //s_client_id : '9d2f6e55-358f-486e-a853-ff36bcf2bd8a', s_client_id : sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_client_id, // Your ADP Client Secret. //s_client_secret : '8b225beb-a137-41e9-94a0-85685596aaef', s_client_secret : sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_client_secret, // Your configured Client Application Callback URI. //s_callback_redirect_uri : 'http://localhost:8890/callback', s_callback_redirect_uri : sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_callback_redirect_uri, // End point for obtaining Access Token. //s_token_endpoint : 'https://iat-accounts.adp.com/auth/oauth/v2/authorize', //s_token_endpoint : 'https://apidit.nj.adp.com/auth/oauth/v2/authorize', s_token_endpoint : sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_token_endpoint, // End point for user info API. //s_user_endPoint : 'https://apidit.nj.adp.com/core/v1/userinfo', s_user_endPoint : sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_user_endPoint, s_user_info_endPoint : function() { return this.s_user_endPoint + sslSettings['COMMON'].s_user_endPoint_common }, // End point for consumer applications API s_CAR_endPoint : function() { return this.s_user_endPoint + sslSettings['COMMON'].s_CAR_endPoint_common }, apiEndpoint : sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_mock_endPoint || sslSettings['ENV'][NODE_ENV || 'LOCAL'].s_netsecure_endpoint, // Token response type. //s_response_type : 'code', s_response_type : sslSettings['COMMON'].s_response_type, // Grant type for Bearer Token API call. //s_grant_type : 'authorization_code', s_grant_type : sslSettings['COMMON'].s_grant_type, // Authentication scope. //s_scope : 'openid', s_scope : sslSettings['COMMON'].s_scope, // Athentication state. s_state : Math.random(), // Full token authentication URI. s_full_token_endpoint : function() { return encodeURI( this.s_token_endpoint + '?client_id=' + this.s_client_id + '&response_type=' + this.s_response_type + '&redirect_uri=' + this.s_callback_redirect_uri + '&scope=' + this.s_scope + '&state=' + this.s_state); }, // Agent options needed to perform Bearer token API call. // This function does a full read of your certificate // files using fs.readFileSync(). agent_options: function(){ return { ca: [fs.readFileSync(this.cert_pem_path)], key: fs.readFileSync(this.cert_key_path), cert: fs.readFileSync(this.cert_pem_path), securityOptions: sslSettings['COMMON'].security_options }; } };