...
Custom Authentication Provider
...
OpenCMIS supports HTTP basic authentication for the AtomPub binding and WS-Security (UsernameToken) for the Web Services binding out of the box. Other authentication methods can be added by implementing a custom authentication provider.
Such a provider must extend org.apache.opencmis.client.provider.spi.AbstractAuthenticationProvider
and overwrite the methods getHTTPHeaders
and getSOAPHeaders
. See JavaDoc for details.
The session parameter SessionParameter.AUTHENTICATION_PROVIDER_CLASS
must be set to the fully qualified class name in order to active the authentication provider before the session is created.
For example:
Code Block | ||||
---|---|---|---|---|
| ||||
Map<String, String> parameters = new HashMap<String, String>();
parameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS, "org.example.opencmis.MyAuthenticationProvider");
parameters.put("org.example.opencmis.user", "cmisuser"); // MyAuthenticationProvider can get and evaluate this
parameters.put("org.example.opencmis.secret", "b3BlbmNtaXMgdXNlcg==");
parameters.put(SessionParameter.ATOMPUB_URL, url); // service document URL
CmisProviderFactory factory = CmisProviderFactory.newInstance();
CmisProvider provider = factory.createCmisAtomPubProvider(parameters);
|