Posts

oAuth , OpenID, OpenID Connect, SAML

oAuth : Open Authorization  Framework  It allows you to delegate access/authorization  to third parties without sharing credentials. Third parties can access the resources on your behalf.  oAuth framework evolved over time.  First oAuth 1.0 came up. It used HTTP ( not HTTPS )  but encrypted the sensitive information at the endpoints.  This made the implementation bit difficult and cumbersome.  oAuth 2.0   is very different than 1.0 and it addressed some of the challenges of 1.0/1.1.  It removed the need for encryption at the endpoints but it requires HTTPS, which is widely available.  It made the implementation faster and easier. It also came up with multiple flows ( auth code, implicit, resource owner credential, client credential, refresh token )  for different scenarios.  Here is link to  oAuth 2.0 flows OpenID is open standard for authentication , promoted by OpenID foundation.  It allows replying partie...

Ajax and 302

Did  you ever wonder what happens if use request a resource via Ajax ( XmlHttpRequest or ActivexObject) for which server sends back 302 ( browser redirect ) ?  Does the xmlhttp.status==302 below will ever be true ? --------------------------------- function test302() { var xmlhttp; if (window.XMLHttpRequest)   {   xmlhttp=new XMLHttpRequest();   } else   {   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");   } xmlhttp.onreadystatechange=function()   {   if (xmlhttp.readyState==4 && xmlhttp.status==302)     {     document.getElementById("myDiv").innerHTML="resource moved."     }   } xmlhttp.open("GET","URL",true); xmlhttp.send(); } ------------------------ The answer is NO. Because browser handles it and never passes it to JavaScript.

Java Keystore, Certificates, Private Keys, Tomcat SSL

I was trying to setup Single Sign On using CAS and I had to deal with creating self signed certificate and configure Tomcat to use it. A few things I learned are following: 1. Tomcat SSL Connector can be configured in two way; JSSE or APR. JSSE uses native libraries and need different connector attributes to be configured.  APR stands for Advanced Portable Runtime. It requires additional libraries to be installed but provides more performance and flexibility.  For normal demo scenario, one may be good with JSSE connector configuration. 2.  To configure JSSE Tomcat SSL connector , you need a keystore. Assuming you are using self signed cert, use following command line. keytool -genkey  -alias ss   -keyalg RSA -keypass pwd  -storepass pwd -keystore  storefilepath This will prompt for first name , last name and organizational information.  Make sure you enter right value for the very first question "first and last name". This becomes CN ...

JAR file contents

Getting contents of all the jar files under a directory on windows:  for /f  %v in ('dir /s /b jboss*.jar')  do jar tvf %v

SQLServer

There are 3 functions which are used to query metadata from SQL Server databases. sp_tables sp_columns sp_stored_procedures There do take parameters to filter the data being queried based on certain criteria.

Browser

If a http call does not return anything until a certain time , you will see time out. So if request processing is going to take long time before you even generate a single bit of response, then you better return some dummy character or something in the meantime to stop browser from timing out. location.replace does take you to new URL but this new URL does not remain in history while location.href does go in history.

Java Encryption/Decryption

Java does not always throw exception while decoding a text using different key than the one used for encoding it. Though the decoded text will be garbage. So dont rely on throwing exception if the key is incorrect. Character.getType(character) returns a in value which stands for a category to which character belongs. esp. the value returned as 28 stands for OTHER_SYMBOLS and it is normally non-printable junk characters.