Hello everyone
I have an application which uses PortCMIS (.NET) library to interact with Alfresco repositories.
It works as expected with 5.0-5.2 versions, but I get an error with locally installed Alfresco 6.0.2.1 (Alfresco Community Edition 201802 EA).
If I try to create a session and get the repository id, an HTTP GET request is sent to receive CMIS 1.1 AtomPub Service Document (http://127.0.0.1:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom). As a result I get "Unauthorized" exception.
The problem also appears in browsers: If I go to http://127.0.0.1:8080/alfresco/ and click "CMIS 1.1 AtomPub Service Document" link, then I will get a response with status code 401.
{ "status" : { "code" : 401, "name" : "Unauthorized", "description" : "The request requires HTTP authentication." }, "message" : "04140012 Authentication failed for Web Script org\/alfresco\/api\/opencmis\/OpenCMIS.get", "exception" : "", "callstack" : [ ], "server" : "Community Early Access v6.0.2 (r9a538671-b197) schema 10 201", "time" : "14.05.2018 19:31:53" }
In Alfresco 5.* after clicking on "CMIS 1.1 AtomPub Service Document" link an alert window appears with username/password fields. But in 6.0 version the alert window is not appearing and therefore the authentication is missing.
Is it possible to avoid this error somehow? For example authenticate the user with other HTTP request (which would be equal to alert window with username/password fields)?
Thanks for help!
Solved! Go to Solution.
It looks like it's a new "feature": https://github.com/Alfresco/alfresco-remote-api/commit/dfb270a6e171b0808f92701128e41261c53faf3f
You can restore the behaviour by setting
alfresco.restApi.basicAuthScheme=true
in alfresco-global.properties
This is default behaviour for REST API authentication. Why do you want the browser to show an authentication popup?
Thank You for reply!
The authentication popup appears in browser if I use Alfresco 5.x. I haven't found any changes about authentication in release notes. According to that, the default behaviour is with an authentication popup and it should also be displayed in 6.0 version.
How should I use in Alfresco 6.0 the "CMIS 1.1 AtomPub Service Document" link, which is displayed on http://127.0.0.1:8080/alfresco, if I cannot use my credentials (like in previous versions) and I get an exception?
CMIS API is not designed to be used from Web Browser.
You can still use it from Postman or developing a client program in some compatible technology (Java, PHP, Python....)
It looks like it's a new "feature": https://github.com/Alfresco/alfresco-remote-api/commit/dfb270a6e171b0808f92701128e41261c53faf3f
You can restore the behaviour by setting
alfresco.restApi.basicAuthScheme=true
in alfresco-global.properties
Just to complete the answer with information provided by Younes REGAIEG in the IRC: when restoring popup behaviour ADF apps will present also the popup in login page (before login in). In fact this patch was developed to avoid this problem.
So if you are using both (CMIS Browsing and ADF apps), you need to raise a new issue to be solved.
Yes, seems to be this is the problem. Thanks again.
I cannot modify alfresco-global.properties file because I expect users to interact with default version from Alfresco Community Edition 201802 EA file list.
Now the main question is: how can I get repositories from Alfresco 6.0 or at least authorize the user using PortCMIS in my app?
I'm using default approach and it works great with Alfresco 4.x/5.x:
var repos = PortCMIS.Client.Impl.SessionFactory.NewInstance().GetRepositories(sessionParameters);
And the dictionary sessionParameters is filled with following values:
Seems like the credentials are not used now and it causes "Unauthorized" exception.
Any ideas how to handle this?
I guess this is a problem related with PortCMIS, as Java CMIS Client is working fine.
I know I am a little late to respond, but I ran across this thread when trying to find a solution to the same issue (except I am using the browser binding) with Alfresco 6 and PortCMIS.
I've been able work around this without any changes to Alfresco configuration by adding a {SessionParameter.PreemptivAuthentication, "true"} as part of the dictionary of parameters that I pass when creating the session.
Regards,
Robert
Old thread, but in case you are using cmislib, the Python CMIS library, you will have to set alfresco.restApi.basicAuthScheme=true in alfresco-global.properties or cmislib will not work.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.