Client Id enforcement on Mule 4 API

Content:

  • It is very important to authenticate the consumer of your API and secure your API
  • For that, you can apply different policies
  • Using API Manager, you can configure and apply policies to an API instance
  • Here we will see how we can apply the client id Enforcement policy to your application in detail
  • Designing API Specifications in Design Center
  • Creating an API using API Manager
  • Implementation Of Application in Anypoint Studio
  • Adding Autodiscover element
  • Deploying Application in Runtime manager to activate API auto-discovery
  • Requesting Access to the API using Exchange
  • Applying a Policy using API Manager

SETUP :

  • Designing API Specifications in Design Center:
  1. Login to your Anypoint platform account and click on “Start Designing.”
  • Creating an API using API Manager:
  1. Once the API is published, go to API Manager and click on Manage API> manage API from Exchange.
  • Implementation Of Application in Anypoint Studio:
  1. Open your Anypoint studio and create a new mule project by selecting file>new>mule project.
  • Adding Autodiscover element
  1. Now create one more mule configuration file called global (global.xml)to add all configuration elements in one file. Goto global of that file and click on create. Select autodiscovery.
  • Find credentials for Environment where you will deploy this application
  1. GO to Access Management and click on Environment. Then click on the sandbox.
  • Deploying Application in Runtime manager to activate API auto discovery
  1. Now your application is ready. Select file>export in Anypoint studio. Select the folder where you want the jar to be created and click finish. This will create a deployable jar.
  • Applying a Policy using API Manager
  1. Go to API Manager and click on policies.
  • Requesting Access to the API using Exchange
  1. Go to Exchange and click on the application name. On the right corner, you will see 3 dots. Click on them and click request access.
  • Calling API with credentials
  1. If you send a request to this API with the wrong credentials, it will give you error 401 Unauthorized.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store