I recently had to develop SSO Authentication for our hosted application using SAML, and hopefully this will help you.
WHY SAML?
If you have a Web application, and would like to implement SSO (Single Sign On), then you need to ask this key questions.
1) Where is the application hosted ? Is it in house or hosted in cloud ?
In House Hosting: In this case you really don't need SAML, as you can work directly with Active Directory or Windows Authentication etc
Hosted in Cloud: This is where you typically implement SAML. As most clients wont be interested in opening up their AD to internet.
You can check SAML for more info, but here are few key concepts.
Your Web application (Service Provider SP) will contact Client's SSO (Identity Provider IDP) to authenticate an user trying to login to your application. IDP will provide the authentication information in a base 64 encoded XML string called SAML Assertion. Your application needs to parse the assertion string and figure out the Authentication information ( typically user name and how long a session is valid)
Here is how the information flows
1) User tries to access your application
2) Your code needs to check if an SAMLResponse variable is available in the "Form Parameters"
3) If SAMLResponse is Null, you need to redirect to Clients SSO Page ( could be Ping, F5 etc.,)
4) User will enter his credentials there, and if successful, it will redirect back to your application login page.
5) When the redirect comes back from client SSO, SAML Response vairable will be set and it wont be null
6) SAML Response or SAML Assetion is a Base64 encoded string. You may need a certificate from client to decode the string to a XML Document
7) You parse the XML Document, get the authentication information, and let them in.
There are 3 things you need before you start your coding
1) Clients SSO URL.
2) You need to provide an URL of your application to the client. This is where Client's SSO will redirect upon successful login (step 1)
3) Certificate information from client ( to read the SAML Assertion string)
Here is my code
Thursday, December 11, 2014
Thursday, November 20, 2014
Oracle: How to use Constants defined in a package in SQL Statement
I have an Oracle package with 100+ Constants defined. I wanted to use those constants in a SQL, and couldn't find any easy option.
I Found this solution in StackOverflow from "Björn", which is brilliant. I just changed the return to Varchar2 instead of number, so it will work for all data types
----------------------------------------------------------------------------------------------------------------
Create or Replace Function get_constant (i_constant IN Varchar2) RETURN Varchar2 deterministic AS
output Varchar2(4000);
Begin
execute immediate 'begin :output := '||i_constant||'; end;' using out output;
Return output;
End;
/
----------------------------------------------------------------------------------------------------------------
Create or Replace Package My_Constants as
number_constant constant int := 9;
varchar2_constant constant varchar2(200) :='Hello There';
Date_Constant constant date := sysdate;
end;
/
select get_constant('My_Constants.number_constant'),
get_constant('My_Constants.varchar2_constant'),
get_constant('My_Constants.Date_Constant')
from dual;
I Found this solution in StackOverflow from "Björn", which is brilliant. I just changed the return to Varchar2 instead of number, so it will work for all data types
----------------------------------------------------------------------------------------------------------------
Create or Replace Function get_constant (i_constant IN Varchar2) RETURN Varchar2 deterministic AS
output Varchar2(4000);
Begin
execute immediate 'begin :output := '||i_constant||'; end;' using out output;
Return output;
End;
/
----------------------------------------------------------------------------------------------------------------
Create or Replace Package My_Constants as
number_constant constant int := 9;
varchar2_constant constant varchar2(200) :='Hello There';
Date_Constant constant date := sysdate;
end;
/
select get_constant('My_Constants.number_constant'),
get_constant('My_Constants.varchar2_constant'),
get_constant('My_Constants.Date_Constant')
from dual;
Friday, October 24, 2014
How to merge tif files
I wrote a .Net C# program to merge multiple ".tif" files to a single "multi-page" tif file.
It has a simple user interface, where you browse to the root folder. It goes all through all sub folders and processes the files and creates a merged tif file per folder.
lets say my root is c:\temp\log, and within c:\temp\log I have folder 3 folders (folder1, folder 2 and folder3)
folder 1 has 200 tif files
folder2 has 10 tif files
folder 3 has 300 tif files.
once you run the program, you will end up with
folder1: All 200 tif files merged to "Merged_Image.TIF", saved in folder1
folder2: All 10 tif files merged to "Merged_Image.TIF", saved in folder2
folder3: All 300 tif files merged to "Merged_Image.TIF", saved in folder2
Let me know if you need it, and did I mention its FREE..
It has a simple user interface, where you browse to the root folder. It goes all through all sub folders and processes the files and creates a merged tif file per folder.
lets say my root is c:\temp\log, and within c:\temp\log I have folder 3 folders (folder1, folder 2 and folder3)
folder 1 has 200 tif files
folder2 has 10 tif files
folder 3 has 300 tif files.
once you run the program, you will end up with
folder1: All 200 tif files merged to "Merged_Image.TIF", saved in folder1
folder2: All 10 tif files merged to "Merged_Image.TIF", saved in folder2
folder3: All 300 tif files merged to "Merged_Image.TIF", saved in folder2
Let me know if you need it, and did I mention its FREE..
Subscribe to:
Posts (Atom)