Authenticating with the repository
When using the AtomPub binding or the Browser binding, authentication is delegated to the transport protocol, which is HTTP. All CMIS-compliant servers must, at the very least, support client authentication using the HTTP Basic authentication schema. We will use this in the following examples. If the server is Alfresco, the alternative is to use the Alfresco login service. As this is not supported by other servers, we will stick to the HTTP Basic authentication, which is portable.
The curl
tool can handle Basic Auth for us automatically; we just have to pass the username and password, as follows, with the -u
switch when we use curl
:
$ curl -u admin:admin
If you are going to work only with Alfresco, you can log in and get a ticket that you can use in subsequent calls as follows:
$ curl "http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin" <?xml version="1.0" encoding="UTF-8"?> <ticket>TICKET_39ea5e46e83a6d6e43845182f4254f9de50402fb...