Authenticating SharePoint 2010 and 2013 using Rest API.
SharePoint supports various Authentication mechanism including the Federated Login, legacy authentication model like Kerbos, Cliams based.If someone who worked on integrating the third party Apps using Oauth 2.0 or Oauth 1.0, definately they are not going to get impressed with the SharePoint Authentication , including me. I have integrated my apps with public storages like Google Drive, Dropbox, Box .,including hosted storages like ECM's especially Alfresco, Documentum 7.1 , CMIS.
Lets get into the SharePoint 2010 & 2013 integrating with Java Client. We will take example with PasswordAuthenticaion from java.net package and connect the sharepoint url by passing the UserName and Password. This is like a BasicAuthentication.
public class SharepointAuthenticator extends Authenticator{
private Properties properties;
public SharepointAuthenticator(Properties props){
properties = props;
}
public PasswordAuthentication getPasswordAuthentication () {
return new java.net.PasswordAuthentication (properties.getProperty("username"),properties.getProperty("password").toCharArray());
}
}
Thats it. its Simple BasicAuthentication.
Next step, how to connect to any of the Sharepoint Rest Api. In our example, we will take SharePoint List and SharePoint delete functions.