September 13, 2016

SAML2 Assertion Query Request / Response Messages - part 3

AuthzDecision Query is used to determine some actions on some resources be allowed to a particular subject. This request message present Evidence such as AssertionIDRef , Assertion to verify subject.

AuthzDecision Query Request Message


AuthzDecision Query Response Message


Customized Error Response Message

IDP must return Response message for each and every request which received from the SP. IDP can report errors in request message or server failures of it self.

Invalid Issuer Error Response 


Invalid SAML Version Error Response 


Invalid Subject Error Response 


Invalid SessionIndex or Auth-Context Error Response 


SAML2 Assertion Query Request / Response Messages - part 2


AuthnQuery Request message is used to check Assertions which match with given Subject and Authentication statements such as SessionIndex, Auth-context.

AuthnQuery-SessionIndex Request Message


AuthnQuery-SessionIndex Response Message


AuthnQuery-AuthContext Request Message


AuthnQuery-AuthContext Response Message


SAML2 Assertion Query Request / Response Messages - part 1


Service Providers are able to query dynamic or existing assertions from Identity Provider by following SAML2 specification, using standard request messages.Identity Provider need to issue Response message for each request. If the request message contains errors, then IDP should add error status and message into the Response message.Response message may contain one or more assertions or no any assertion.

Attribute Query Request Message


Attribute Query Response Message


AssertionIDRequest Request Message


AssertionIDRequest Response Message

August 23, 2016

GSoC 2016 : SAML Assertion Query/Request Profile support for WSO2 Identity Server

Introduction

WSO2 Identity Server is an open standards based Identity and Access Management system. It supports some of the major SAML2 based profiles such as Web Browser based SAML2 SSO, Single logout, Basic attribute profile and also WS-Trust.  Therefore Identity Server issues SAML2 Assertion to requested entities.  It can act as “SAML Authority” according specification. Although Identity Server can issue SAML2 Assertions based on various standards, currently it does not support for Assertion Query/Request Profile.  So, implementing this profile, will add more value to Identity Server. "Assertion Query/Request Profile" defines a protocol for requesting dynamic or existing Assertions from SAML Authority by reference or by querying on the basis of a subject and additional statement-specific criteria. Assertion Query/Request Profile is based on five Assertion request messages. 

Workload

Assertion Request Messages Processing

SAML Authority (WSO2 Identity Server) receive five types of requests to query Assertions. I Implemented new component with service end point to receive these request messages and validate messages. Then according to the request message type  query assertions from databases, build response message and return response message to requester. 

Assertion Store Feature in WSO2 Identity Server

I implemented custom assertion builder to persist assertions before return assertions to the Service Providers.

Code Contribution

(SAML Assertion Query Profile as a component)
 (Integration Tests)
 (Assertion Persistence Feature)
(SAML Assertion Query Profile Implementation )

Future Works

WSO2 Identity Server does not support to persist assertions in database. So writing new component to store assertions and mount a new table for assertions in carbon-identity-framework is challengeable. The technique of storing assertions is directly affect server performance. So it is required to use cache and background processes to reduce server delay on read and writes as a future work.


Useful Links



Conclusion

I would like to thank my mentor Omindu Rathnaweera,  Asela Pathberiya and WSO2 IS team for the great support and help they provided for the success of this project. Thank you very much Google for the great opportunity given to me.

October 8, 2015

How to Use Singleton Design Pattern In Java

velozit.blogspot.com
Singleton is the simplest design pattern which has categorized under creational design patterns.Most significant difference of the Singleton design pattern is allowing application to create only one instance from start to the end of the application.Singleton manage a global instance that can be access by other instances.

Assume we have a system that can manage online users.In there, system is  counting user login events and user logout events.This is like a log file.The whole system needs only one log file and it is maintaining accurate user count.

Here a sample class file created for above scenario.Refer this code and try to understand the behavior of singleton pattern.
--source code can be not loaded because of  network issues--


Output :

output

Some of disadvantages of Singleton Design Pattern

1. Do not allow inheritance.
2. In a garbage collected environment singletons can quickly become an issue with regard to memory management.
3. Singletons are also a problem from a testing perspective. They tend to make isolated unit-tests difficult to write.
4. You can not rely that there is exactly one instance of a singleton in your application - especially when it comes to clustering
5. There is also the multi-threaded scenario where singletons can become a issue as well as a synchronization issue.

Do more coding.Explore innovations.


January 22, 2015

December 25, 2014

Create a clock using Java for your application. Clock will display on jlabel.

Create a clock using Java for your application

This code is to indicate system time on your application.This code is depending on your system time while startup the application and then it do feather calculations and counting to maintain accurate time.

This time function can simply  embed to a jlabel.

December 24, 2014

December 21, 2014

Programme VFD Display using java source code. Using RXTX drivers.

Programme VFD  display using java source code

This post is about how to program VFD display using java.This code is specified for COM port.Here you need to download hardware acceleration supports from external supports.Follow given steps and refer the correct documentation related to your vfd device and replace correct byte code for given functionalities.

STEP 1: 
This VFD Customer Display has Serial cabel.So Download serial port drivers from this link 
http://sangon.altervista.org/bin/mfz-rxtx-2.2-20081207-win-x86.zip

STEP 2: 

 Unzip archive file and read instructions inside install.txt file. Follow instructions and copy files into mentioned directories.

STEP 3:

 If you use IDE like netbeans or eclips, Import RXTXcomm.jar file into lib or library folder. 

STEP 4:

 Now your computer is ready to run this class.Now install you customer display manufacture's driver package.Restart your computer.

STEP 5: 

Now you had to configure your display's basic settings for COM1.
    Baud Rate:          9600
   Data Bits:            8
   Parity:                None
   Stop Bits:           1
   Flow Control:   None
For that you can use driver application or switch system of display.
STEP 6:  
 Undestanding command mode.
basic command modes:                            1.   EPSON ESC/POS
                                                                    2.   EMAX (AEDEX)
                                                                    3.   UTC
                                                                    4.   ADM787/788
                                                                   5.   CD5220
                                                                   6.   DSP-800 (optional)
Here we use EPSON ESC/POS command system.First download user manual of your display.Inside manual you can find commands relevent to your display.
Ex: show timer on display Hex code :  1F  55
we need to convert this hex code to byte array like this 
byte time [ ]={0x1F,0x55};
STEP 7:
Download Display.java file and ESC/POS.java file from github and execute your programe.
STEP 8:
Enjoy java programming.


I like to expand this tutorial to tell you how to program a USB display.Please see the below code.
credit : CristianoGhersi

December 20, 2014

How to Print using java source code

How to print using java source code
This java class enable you to print documents or receipts easily.You can customize this class to print A4,A3,Letter and other sizes.Try this class to integrate printing function to your java application.

It is free to try this class.Enjoy java.Share java.

January 30, 2014

how to install java on windows computer

What is java?




Java is a cross platform, object oriented, concurrent computer programming language.It was designed by Sun microsystems in 1995.Now it maintain by Oracle corporations.

What should know before install java?

We can find e types of packages in java.[ java ME(micro edition) ,java SE(standard edition) , java EE(enterprise edition)].
Generally  we use java SE for software development.
When you downlaod java  there are 2 types you can find.
                   jdk-java development kit
                   jre-java runtime environment

Above diagram show you jdk is  a all inclusive package.I use java SE jdk package for installation.

1st Step


Go to this link and download jdk package which is matching to your system.Consider Operating system,bit version and jdk version.

2nd Step


Install application and reboot your computer.Now you can open command prompt by typing cmd in run place.Now type javac and press enter.It shows  you an error message.That is why you cant run any java code in any place without changing  environmental variables.You can run java codes in bin folder in your java installed place.

3rd Step


Now go to
My Computer ->Properties ->Advanced ->Environment Variables.
Then go to user variables and find path variable.Select it and then select edit.Now you can see variable name and variable value.there can be already value but some time free text box.Now go to java bin folder and copy and paste  it in field of value.
Ex-   ;C:\Program Files\Java\jdk1.7.0\bin .Now put a semicoalan before C if only pre values there.
Do same thing to the system variables.



After all press ok and reboot your computer.
Now get command prompt and type javac and press enter.If your java is working properly you can see this list.Now you can compile your java programmes at any place you want.


See you again next time.