UNPKG

oidc-lib

Version:

A library for creating OIDC Service Providers

46 lines (34 loc) 1.4 kB
module.exports = { registerEndpoints: registerEndpoints, invokeAuthUserAgent: invokeAuthUserAgent, invokeConsentUserAgent: invokeConsentUserAgent } const moduleName = '{{_moduleName}}'; var viewPath = null; var pk = null; function registerEndpoints(pkInput) { pk = pkInput; viewPath = pk.util.content_views(moduleName); // Add endpoints to accept form posts or gets by user agents here: } function invokeAuthUserAgent(res, params, encoded_sts_state_bundle) { pk.util.log('--- _CREATOR_: INVOKE AUTH USERAGENT ---'); // Replace the remainder of this function with Auth UI code var content_module_state = {}; content_module_state.newIdTokenContent = { email: 'testuser@testdomain.com', sub: 'some-random-number' }; pk.sts.prepareAuthResponse(res, encoded_sts_state_bundle, content_module_state); } // Insert authentication form post handler here function invokeConsentUserAgent(res, scopeInfo, registrationInfo, encoded_sts_state_bundle, content_module_state) { pk.util.log('--- _CREATOR_: INVOKE CONSENT USERAGENT ---'); // Replace the remainder of this function with Consent UI code content_module_state.consentInfo = { scopeArray: ['openid', 'email'], claims: {id_token: {}, userinfo: {} } }; pk.sts.applyConsentResponse(res, encoded_sts_state_bundle, content_module_state); } // Insert consent form post handler here