Sunday, November 13, 2016

[WSO2 API Manager] How to Add a User Signup Workflow

From WSO2 API Manager, new developers can self-sign up to the API Store.  After that,  they can login to API Store using that account. But if admins want to approve those new accounts before new developers use their accounts, workflows can be configured. For that, we are using WSO2 Business Process Server (BPS).

Let's see how to add a user signup workflow.

  1. If API Manager and Business Process Server are running on the same machine, follow this step.

  2. Set Offset value to 2 in <BPS_HOME>/repository/conf/carbon.xml.
       
        <Offset>2</Offset>  
       
    
  3. If there is no directory called "epr" inside <BPS_HOME>/repository/conf/, then create it.
  4. Copy following epr files from APIM_HOME>/business-processes/epr to <BPS_HOME>/repository/conf/epr.
    • UserSignupService.epr
    • UserSignupProcess.epr
  5. Start BPS and login to Management console.
  6. Go to Home > Manage > Processes > Add > BPEL. Then, upload <APIM_HOME>/business-processes/user-signup/BPEL/UserSignupApprovalProcess_1.0.0.zip.

  7. Go to Home > Manage > Human Tasks >. Then, upload <APIM_HOME>/business-processes/user-signup/HumanTask/UserApprovalTask-1.0.0.zip.


  8. Configuration on BPS is finished.  Now, let's see how to configure WSO2 APIM.
  9. Start APIM and  login to Management console.
  10. Go to Home > Resources > Browse and navigate to /_system/governance/apimgt/applicationdata/workflow-extensions.xml. Click on "Edit As Text". 
  11. Comment <UserSignUp executor="org.wso2.carbon.apimgt.impl.workflow.UserSignUpSimpleWorkflowExecutor"> and uncomment  <UserSignUp executor="org.wso2.carbon.apimgt.impl.workflow.UserSignUpWSWorkflowExecutor">
  12. Also, update below property values based on your BPS server credintials, service endpoint.
       
     <UserSignUp executor="org.wso2.carbon.apimgt.impl.workflow.UserSignUpWSWorkflowExecutor">  
          <Property name="serviceEndpoint">http://localhost:9765/services/UserSignupProcess/</Property>  
          <Property name="username">admin</Property>  
          <Property name="password">admin</Property>  
          <Property name="callbackURL">https://localhost:8243/services/WorkflowCallbackService</Property>  
       </UserSignUp>  
       
    

    Now Configuration in API Manager is finished. 
  13. Now, go to API store and sign up to the store. 
  14. When you signup to the API Store you will get a Notification. (User account awaiting Administrator Approval).
  15. Then, login to Admin Dashboard (https:<Server Host>:9443/admin). 
  16. Go to Tasks > User Creation. Then you will able to see the pending user approval tasks like below.
  17. If you click on "Start" button, the tasks status changed into "In_Progress". 
  18. Once, you click on "Complete" button, signed up user account become active and that user able to login to the API Store.

1 comment:

  1. Thanks for this tutorial.

    Suppose I wanted to enable the user get email notification after approval, what do I need to do.

    Thanks.

    ReplyDelete