Skip to main content

Posts

Showing posts with the label Identity Server

How to debug WSO2 Carbon products with Eclipse

When you are doing some customizations, you may have to debug the custom codes. I'm going to give you steps to start the debug with Eclipse. Step 1 :- First you need to start the product with below command. sh wso2server.sh -debug 5005 When you start the server with above command, Server is listening for the port 5005. Step 2 :-  Open the debug configuration window and create a new Remote Java Application. Keep the host as localhost and give the port which you started in the first step. After do the modifications, you can start debug by clicking Debug button in Debug Configuration Window. If you configured correctly, Server will be started without any problem.

Configure mysql database with WSO2 Identity Server

One of the main usage of Identity Server is for user management. It gives us a lot of features.List of features are available in this page . Some of them are, Multiple user store support User, password and profile management JDBC, LDAP/AD support Default user store of Identity Server is the embadded LDAP and its a forked implementation of ApacheDS . Other configuration Data, Registry are available in H2 database. Embedded LDAP and H2 database are not recommended in production environment. So; We have to use commercially available databases/LDAP implementations for production. Today I'm going to explain the way to use mysql database with Identity Server. We can do it following few steps. Step 1 :-  Disable embedded LDAP property in embedded-ldap.xml file which is located in <IS_HOME>/repository/conf/identity/ <Property name="enable">false</Property> Step 2 :-  Create a database and generate required tables using provided sql file...

How to Create a Secondary JDBC user store for Identity Server

WSO2 Identity server comes with embedded LDAP as a primary user store. But its not recommended  to use in production environment. So; you have to use some other products for primary user store(OpenLDAP, AD, JDBC, etc..). You may required some other user store in practical scenarios. So; I'm going to talk about how to create a JDBC user store as a secondary user store with wso2 IS. I'm using wso2 Identity server latest version(current Identity server version is 5.1.0) for this example. Step 1 :- Log in to mysql using below command. Lets create a database first. mysql -u root -proot Create a database as below. create database sampledb; Use newly created database for other operations. use below command. use sampledb; Step 2 :- Then create tables which are required for user store. You can use mysql.sql file which is located in <IS_HOME>/dbscripts/ directory to import tables to newly created database. please use this command source /home/madura/D...

Run WSO2 Identity Server inside the docker container

Docker is a light weight container which runs on any computer or any cloud. It runs as an isolated process on the host operating system and its easier to create, deploy and run application. It is bit like a virtual machine, but it has different architectural approach which allow us to portable and efficient development. You can install docker using this documentation  on Linux. Step 1 :- You need to create a docker file. I have provided a simple docker file which use to copy identity server in to a docker image. Please copy below two lines in to a new file and modify file name as 'Docker'. I'm creating a directory 'is500image' somewhere  and put this file in to that directory. Sample Dockerfile to create a docker image with WSO2 IS 5.0.0. FROM cogniteev/oracle-java:java7 ADD ./wso2is-5.0.0.tar.gz /opt/wso2 Step 2 :- its better to create a tar.gz file using below commands. tar.gz file unzip its contend when its coping to docker image. You may creat...

Invoke admin services in wso2 identity server via HTTP instead of HTTPS

It is possible to access WSO2 identity server over HTTP protocol. But Its not recommended in production environment. When you enable HTTP protocol, you can access admin console using different port(9763) Step 1 :-  Open carbon.xml file which is located in <IS_HOME>/repository/conf directory and do below changes <EnableHTTPAdminConsole> true </EnableHTTPAdminConsole> You can log in to the management console using this url  http://localhost:9763/carbon/admin/login.jsp If you want to expose all WSO2 admin services via HTTP, you need to  enable following property in carbon.xml file. It is also commented by  default. <HttpAdminServices>*</HttpAdminServices> this is commented by default and you have to uncomment the line. These configurations are enough for WSO2 identity server 5.0.0. If you need to enable http for wso2 identity server 5.1.0, you have to modify web.xml file as mentioned in Step 2. Step 2 :- M...

How to use RESTclient to get access token from WSO2 Identity Server

Access token can be retrieve in different ways. This blog is explained the way you can get access token using cURL command. As a next step, I'm going to explain the way you can retrieve an access token using Advance REST client(Firefox plugin). Step 1 :- First create a service provider in WSO2 Identity server. Register a new application by providing callback url and allowed grant types. You must tick a password grant type because I'm going to get an access token using password grant type After above configurations are done. You can see the generated client key and secret as below Now you have client key and client secret for particular application. That means, you have completed the first step. Step 2 :- Get the base64 encoded value for client key and secret. before get the encoded value, client key and secret should be separated by colon. <client_key>:<client_secret> VbUbPR4a5c8wSIlRFfVq9j3UYCka:KBkyfyEtop2pOvOuiODCZIHqN0Ma This...

CURL commands to get access token from WSO2 Identity Server

WSO2 Identity server supports all grant types those are defined in oAuth2 core specification Four grant types: Authorization Code Grant Implicit Grant Resource Owner Password Credentials Grant (password) Client Credentials Grant We cannot use curl command directly to get an access token for Authorization code grant type and Implicit grant type. I'm going through other two grant types one by one and provide the curl command to get access token. 3. Get access token using password grant type curl -k -d "grant_type=password&username=admin&password=admin" -H "Authorization: Basic ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd0dE1h, Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd is the encoded value of 0N_mwVEzSVx_jRHl5vrg8Dr2pvAa:tFfcpuEDS9WWvxQDsVBwKVTgttMa (<client_id>:<client_secret>). these...

CURL commands to get access token from WSO2 Identity Server

WSO2 Identity server supports all grant types those are defined in oAuth2 core specification Four grant types: Authorization Code Grant Implicit Grant Resource Owner Password Credentials Grant (password) Client Credentials Grant We cannot use curl command directly to get an access token for Authorization code grant type and Implicit grant type. I'm going through other two grant types one by one and provide the curl command to get access token. 3. Get access token using password grant type curl -k -d "grant_type=password&username=admin&password=admin" -H "Authorization: Basic ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd0dE1h, Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd is the encoded value of 0N_mwVEzSVx_jRHl5vrg8Dr2pvAa:tFfcpuEDS9WWvxQDsVBwKVTgttMa (<client_id>:<client_secret>). these...

Renew access token using refresh token in WSO2 Identity Server

When you are using same access token for some period, you may need to renew the old token due to expiration or security concerns. You can renew an access token using a refresh token, by a REST  call with below curl command. curl -k -d "grant_type=refresh_token&refresh_token=eaa3683b1cf78496b6c1e5b7ffc882&scope=PRODUCTION" -H "Authorization: Basic ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd0dE1h, Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token eaa3683b1cf78496b6c1e5b7ffc882 is a refresh token. ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd is the encoded value of <client_id>:<client_secret>. these value should be separated by colon(:). https://localhost:9443/oauth2/token is the token endpoint url. when you use above request, you may get this type of response {"token_type":"bearer","expires_in":3600,...