fb
WSO2 Identity Server 4 min

WSO2EASY: Adding Samples to WSO2 Identity Server

Rob Blaauboer
Rob Blaauboer
Integration Consultant & WSO2 Trainer
WSO2 Easy Adding Samples to WSO2 identity server
Scroll

WSO2_Easy.pngWhere most WSO2 products have a sample directory included in the downloadable product, WSO2 Identity Server lacks these samples. But fear not, you can simply download them and add them to your installation. The samples are excluded since they are quite big and would, for many, make the download rather big.

The value of samples

Samples are an invaluable resource for anyone wanting to work with WSO2 products. From the 100 or so samples in the WSO2 Enterprise Service Bus to the more modest 12 samples in the WSO2 Identity Server, it will help you understand the product and it’s capabilities better.

  1. OAuth2
  2. OpenIDConnect
  3. Configuring Single Sign-On
  4. Configuring Sample Application For Identity Management
  5. Writing a Web Service Client for Authentication and User Admin Services
  6. Testing Identity Server’s Passive STS
  7. Consuming SCIM Rest Endpoints from a JAVA Client Application
  8. Running an STS Client
  9. XACML Sample for an Online Trading Application
  10. Broker Trust Relationships with WSO2 Identity Server
  11. Login to the Identity Server Using Another Identity Server – SAML2
  12. Login to Identity Server Using Another Identity Server – OAuth2

So let’s add those samples to the Identity Server. (Note that actually in the samples there are only 11 sub directories, we already asked WSO2 where the mixup might be and will update the article when we have an answer).

Get Git

The first thing you need when you want the samples is GIT. You need to download GIT from the internet in order to make it work on the command line as shown in the examples below.

We are showing the commands here for Suse Linux Enterprise Server. For other Linux or Windows operating systems, see the website of Git for some help on installation.

After downloading GIT we can start to add the samples to the Identity Server.

For Linux Suse (my Linux OS of choice), installing git is as simple as typing:

  • Zypper install git

Creating a samples directory

In many WSO2 products, the samples are in a ‘samples’ directory, directly under the [CARBON_HOME] directory, for instance wso2esb-4.9.0/samples.

We can install the samples simply in a similar directory (e.g. samples) or you can create your own location. For this article we assume the samples are to be installed in the (to be created) samples directory.

To be able to deploy a sample of Identity Server, you need to download it onto your machine first.

Navigate to the directory where Identity Server is installed, either in a command window or a terminal window (linux). We choose this option since the commands are all command window or terminal based.

You are now in a directory called WSO2-IS.5.1.0 (this blog works with version 5.1.0)

Type in the following commands:

You will find the directory downloaded onto your local folder.

The folder will have a structure as follows:

WSO2_Easy_Adding-Samples-to_WSO2-identity-server.png

This blog is updated since its originally posting due to the changes that WSO2 made in the github repository.

The most important thing to realize is that you downloaded the source files and in order to use them, must be turned in to compiled format, e.g. a war file.

This is done using the maven command: MVN CLEAN INSTALL.

This command will build the required file (e.g. a WAR file in case of the Recovery Sample that needs to be deployed on Tomcat). Note that, because of the dependencies that Maven wants to download an internet connection is needed and it can take some time to compile.

We will not describe in detail the whole compilation process.

Getting it up and running

Each of the samples we just downloaded is accompanied by a description in the online documentation on the Identity Server. This includes things like for instance the version of Tomcat to be used or the settings and parameters that should be set in the Identity Server and other products in order for it to work.

The value of samples

With the samples now included in Identity Server you get a head start on configuration and development and you do not need to invent the wheel again. The samples can be studied and if needed changed in order to suit your situation.

If you have any questions about this blogpost contact us via the comments section of this blog. View also our WSO2 Tutorialswebinars or white papers for more technical information. Need support? We do deliver WSO2 Product Support, WSO2 Development SupportWSO2 Operational Support and WSO2 Training Programs.

Working daily with WSO2 products we sometimes encounter things that even we did not know yet, but in fact are so handy we want to share it with the whole world. We have created a new group of articles called WSO-2-EASY that will show some of best tips and tricks that will help you to either save time or create tidier code    WSO2Easy.png

Full API lifecycle Management Selection Guide

WHITEPAPER

smartmockups l0qqucke