Skip to main content

Posts

How to retrieve Attributes (fields) in Active Directory using jaggery?

We can get user attributes in Active Directory using jaggery and need to follow the steps which were provided in the previous blog . <% var carbon = require('carbon'); var tenantId = -1234; var url = 'https://localhost:9443/admin/services/'; var server = new carbon.server.Server(url); var userManager = new carbon.user.UserManager(server, tenantId); var result = userManager.getClaims("WSO2USERSTORE/testuser", "default"); for(i =0; i<result.length; i++){ print(result[i].getClaimUri() + " ==> " +result[i].getValue()); print('<br>'); } %> Here, getClaims(username String, profile String) method is used to get all claim values of the user in the profile and it returns a JSON object with all claims that user has and their values.

How to list all users belongs to particular user store using jaggery?

We can list all users belongs to particular user store using jaggery. To achieve this, create a directory(ListUser) inside "<BPS>/repository/deployment/server/jaggeryapps" and then create a jaggery file(listUser.jag) inside a newly created folder. In this example, I used WSO2 BPS to test this sample. Add the following content into listUser.jag file. <% var carbon = require('carbon'); var tenantId = -1234; var url = 'https://<HOSTNAME>:9443/admin/services/'; var server = new carbon.server.Server(url); var userManager = new carbon.user.UserManager(server, tenantId); print(userManager.getUserListOfRole("ROLE")); %> Here, you need to change the "HOSTNAME" and "ROLE" according to your config. Please find the sample listUser.jag blow, where my "HOSTNAME" is localhost and user "ROLE" is WSO2USERSTORE/clerk. <% var carbon = require('carbon'); var tenantId = -1234; var url = 'http...

RESTful API for WSO2 API Manager

Here, I will explain, how to create an API through API Publisher .  This request is to obtain the consumer key/ secret key pair. curl -X POST -H "Authorization: Basic < BASE64 username:password >" -H "Content-Type: application/json" -d '{"callbackUrl": "www.google.lk","clientName": "rest_api_publisher","tokenScope": "Production","owner": " username ","grantType": "password refresh_token","saasApp": true}' https:// api.cloud.wso2.com /client-registration/v0.11/register Note: The <user name> should be email@organization_key. For example, if the e-mail is john@gmail.com, the <user name> should be  john@gmail.com@organization_key. You can find the organization_key on the Manage page of the cloud. Sample Request: curl -X POST -H "Authorization: Basic dml2ZWthbmFudGhhbxxxxxxxxxxxxxx= " -H "Content-Type: ...

How to add custom headers to published APIs in WSO2 API Cloud?

This blog guides you to add additional headers to published API in WSO2 API Cloud .  The API Cloud is based on WSO2 API Manager , WSO2's complete solution for designing and publishing APIs and managing a developer community. In order to add additional headers to the allowed headers, we have to configure CORS headers per API level . Once we configure, we can include additional headers in the API Console. In the example below, we will add a custom header called " setName " to an existing API and invoke it from the Developer Portal. Edit a published API and then click "Next: Implement >"          Select the Enable API based CORS Configuration check box to enable CORS for the API. Add the additional headers in "Access Control Allow Headers", then Enter and click Save. Now we have completed for configuring  CORS headers. Then we need to include additional headers in the API Console. Edit a published API again, then nav...

How to integrate WSO2 ESB SNMP Connector with Google Spreadsheet Connector?

In my previous blog, I describe how to work with SNMP Connector and now I am going to do a scenario by integrating the SNMP Connector with the Google Spreadsheet connector. This scenario explains that insert the data which is the response of the SNMPSet operation to the spreadsheet. Before start, the ESB, download snmp4j-2.5.5.jar and add it to the <ESB_HOME>/repository/components/lib directory. Environment Setup Download ESB 5.0.0 from  here . Upload the following connectors. (Refer this to  add and enable the connector ) snmp-connector-1.0.0 googlespreadsheet-connector-3.0.0 Follow the  instruction  to get the credential for the Google Spreadsheet Connector. Following is a sample proxy service that illustrates how to test the above scenario. <?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="SNMPSetScenario" startOnLoad="true" statistics=...

Working with WSO2 SNMP Connector

SNMP Connector allows you to monitor and configure the network components such as servers, routers, switches or printers through the WSO2 ESB. Simple Network Management Protocol (SNMP) is an Internet-standard protocol for managing devices on IP networks. It uses the snmp4j library which is an enterprise class free open source SNMP implementation for Java™ SE. Before start, the ESB, download snmp4j-2.5.5.jar and add it to the <ESB_HOME>/repository/components/lib directory. Environment Setup Download ESB 5.0.0 from  here . Deploy the SNMP Connector.(Refer this to  add and enable the connector ) Following is a sample proxy service that illustrates how to test the SNMPSet operation. <proxy xmlns="http://ws.apache.org/ns/synapse" name="SNMPSet" startOnLoad="true" statistics="disable" trace="disable" transports="https,http,local"> <target> <inSequence...

How to integrate WSO2 ESB File Connector with Gmail Connector?

In this section, I am going to describe  a connector scenario by integrating the File Connector with  the Gmail connector.  For an example, you can use  the File Connector to read a file content and send that content using Gmail Connector. Environment Setup Download ESB 5.0.0 from  here . Upload the following connectors. (Refer this to add and enable the connector ) fileconnector-connector-2.0.6 gmail-connector-3.0.4 Follow the instruction to get the credential for the Gmail connector. Following is a sample proxy service that illustrates how to test the above scenario. <?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="Read_AND_sendMail" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="source" expression="json-eva...