Hi Yugandhar,
I'd really suggest you to implement what I just told you to implement - I hardly think you will really find a better approach, but most of all I believe you will learn a lot as soon you end up with a solution for your problem.
"But how do we call it in UI5 app?" - JSOMModel.loadData("/your/service/url");
When you look into Jun Wu sample (which is pretty much your method implementation) the @Path tells you where your service is located, the @GET tells you that handler will only be used upon a GET and that it will produce a JSON.
What you probably don't understand is that once a client browser performs a "login" into SAP Portal a cookie is returned by by a similar function from the UME API via a "Set-Header" parameter - the browser now carries this cookie and every single cookie from a domain is sent on every request.. and you're just passing the request to SAP UME API to parse, so it will find the cookie and check the validity and either provide you or not the User from the UME (AS Java).
Dan.