tag:blogger.com,1999:blog-7177666583423024162.post4738944996942554577..comments2013-07-10T07:01:33.841-07:00Comments on ECM on Cloud: ECM on Cloud Anonymoushttp://www.blogger.com/profile/14511746265109350376noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-7177666583423024162.post-70509833639953339452013-07-10T07:01:33.841-07:002013-07-10T07:01:33.841-07:00Thank you for sharing.Thank you for sharing.Anonymoushttps://www.blogger.com/profile/04346773997650408589noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-77396827470009433852013-06-27T18:57:45.279-07:002013-06-27T18:57:45.279-07:00Thnak you very much for your help Sumanta, I appre...Thnak you very much for your help Sumanta, I appreciateAnonymoushttps://www.blogger.com/profile/12580873585613037026noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-18989079366602027922013-06-26T17:04:30.411-07:002013-06-26T17:04:30.411-07:00@Joe, I did it through LDAP authentication. I'...@Joe, I did it through LDAP authentication. I've written REST WS which will be invoked on login to validate against email id. This REST WS will give JSON output to calling application. Here is REST WS code to validate against LDAP- <br /><br />@GET<br /> @Path("/sample/{uname}/{pass}")//Rest path<br /> @Produces(MediaType.APPLICATION_JSON)<br /> public Person getSamplePerson(@PathParam("uname") String username,<br /> @PathParam("pass") String password) {<br /> String valid = isValiduser(username, password);<br /> Person person1 = new Person(1, username, password, "sumantapakira@gmail.com",valid);<br /> System.out.println("Returning sample person: " + person1.getFirstName() + " " + person1.getLastName());<br /> <br /> return person1;<br /> }<br /> <br /> private String isValiduser(String username, String password){<br /> Hashtable env = new Hashtable();<br /> env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");<br /> env.put(javax.naming.Context.PROVIDER_URL, "ldap://localhost:10389");<br /> env.put(javax.naming.Context.SECURITY_AUTHENTICATION, "simple");<br /><br /> //String uid = "testuser1";//supplying userid manually<br /> //String password = "password";<br /> String isValid = "Invalid User Name or Password";<br /> DirContext ctx = null;<br /> try { <br /> ctx = new InitialDirContext(env);<br /> String base = "ou=users,ou=system";//base<br /> String filter = "(objectClass=*)"; <br /> SearchControls ctls = new SearchControls();<br /> ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);<br /> String dn = "uid="+username+",ou=users,ou=system";<br /> ctx.addToEnvironment(javax.naming.Context.SECURITY_PRINCIPAL, dn);<br /> ctx.addToEnvironment(javax.naming.Context.SECURITY_CREDENTIALS, password);<br /> ctx.lookup(dn);<br /> isValid = "Valid";<br /> System.out.println("Authentication successful");<br /> <br /> <br /> <br /> <br /> <br /><br /> } catch (NamingException e) {<br /> isValid="Not Valid";<br /> e.printStackTrace();<br /> <br /> } finally {<br /> try {<br /> ctx.close();<br /> } catch (NamingException e) {<br /> // TODO Auto-generated catch block<br /> e.printStackTrace();<br /> }<br /> }<br /> return isValid;<br /> }<br />Once you call from your calling application, you need tp parse JSON object like below - <br />String url ="http://address:port#/Authintication/services/person/sample/"+mEmail+"/"+mPassword;<br /> HttpResponse response = doResponse(url);<br /><br />JSONObject jso = new JSONObject(success);<br />String isValiduser = jso.getString("isValid");<br />if("Valid".equals(isValiduser)){<br />call your activity<br />}<br />Remember this has to be done from onPostExecute() methodAnonymoushttps://www.blogger.com/profile/14511746265109350376noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-90351828956103079922013-06-26T01:49:09.166-07:002013-06-26T01:49:09.166-07:00Thank you for this effective tutorial! Can you pls...Thank you for this effective tutorial! Can you pls let me know how did you implement security to connect from mobile device to ECM system? Thanks! - JoeAnonymoushttps://www.blogger.com/profile/12580873585613037026noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-72649367760364739772013-06-18T17:00:26.651-07:002013-06-18T17:00:26.651-07:00Thanks all! I'm glad to know that it's gon...Thanks all! I'm glad to know that it's gonna help you!Anonymoushttps://www.blogger.com/profile/14511746265109350376noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-71425136331399680012013-06-18T16:58:23.288-07:002013-06-18T16:58:23.288-07:00Great application! I'm sure this knowledge wil...Great application! I'm sure this knowledge will open new era of ECM market! I'm planning to build for such application with the help of your tutorial!Anonymoushttps://www.blogger.com/profile/02322802832299245240noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-68882838863515104422013-06-15T15:38:34.390-07:002013-06-15T15:38:34.390-07:00First of all thanks for sharing this valuable know...First of all thanks for sharing this valuable knowledge. I was looking for this solution for our Organization. Anonymoushttps://www.blogger.com/profile/17642233463833080455noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-16943425445790064992013-03-20T17:44:55.163-07:002013-03-20T17:44:55.163-07:00Good one.Good one.Anonymoushttps://www.blogger.com/profile/11418183624305828368noreply@blogger.comtag:blogger.com,1999:blog-7177666583423024162.post-66201131653342655312013-02-27T19:21:12.691-08:002013-02-27T19:21:12.691-08:00it's very good and useful , looking for more k...it's very good and useful , looking for more knowledge sharing from you. debajyotihttps://www.blogger.com/profile/13976721729199758087noreply@blogger.com