How to write a test class for "ConnectedAppPluginExample", mentioned by salesforce, here -> https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Auth_ConnectedAppPlugin.htm#apex_class_Auth_ConnectedAppPlugin

Here is the background: For the OAuth2.0 flow, we register/configure our app in the connected-app of salesforce and get the consumer_key and comsumer_secret and configure these key and secret and make a request to Salesforce to get the authorization code(after user authentication) and with that authorization code, we make one more request to get the access token. If we want to add id_token along with access token (ID token is a signed data structure that contains authenticated user attributes, encoded as a JSON Web Token (JWT)) we need to configure connected-app in Salesforce as below,

Custom Connected App Handler

ID Token will have 3 things, 1.The algorithm used 2.Payload 3.Signature

If we have to customize the custom attributes of the Payload, then salesforce says we need to implement a plugin and point it in the "Custom ConnectedApp Handler" section as shown in the pic above and the document is in the link.

But the documents don't say anything about writing a test case for this plugin or how to, because the execution of this plug-in is through a OAuth flow.

So, My question is "How to write a test class for this plug-in".

  • 1
    best you include the essentials of the link, what you have tried so far, and where you are stuck. Please take some time to read How to Ask and take the tour in order to get familair with the forum. Thanks! – glls May 29 '18 at 12:50
  • Sure Sir, Done ...! Please have a look. – Karthik H Jun 1 '18 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.