问题
I have developed a web service using service builder portlet, which will return a list of documents from Liferay (6.2 EE). I am returning the default document download URL like the following:
{
...
"downloadUrl": "http://localhost:8080/documents/10181/12306/folder1_doc1/98188996-af04-41c8-b0b6-10b83bf17ee4"
}
When the client calls the web-service he is passing user name and password in header with basic authentication.
But when the client is trying to call the document URL with the same basic authentication Liferay returns a HTML page asking for login to access this document. How can I access the document without that login page?
回答1:
You will have to add the BasicAuthHeaderAutoLogin
to the auto.login.hooks
property for your portal.
For example add this to your portal-ext.properties
:
auto.login.hooks=...copy line from WEB-INF/lib/portal-impl.jar/portal.properties...,\
com.liferay.portal.security.auth.BasicAuthHeaderAutoLogin
来源:https://stackoverflow.com/questions/32522468/how-to-download-document-using-download-url-in-liferay