How to authenticate a user through Spring Security and MarkLogic Java Client API?

What is the best way to check if a user can be authenticated against a MarkLogic server (version 7.0.4) using the Java Client API (2.0.4) for a login dialog that supports the Spring web application?

With my current approach (see source code in gist ) I implement AbstractUserDetailsAuthenticationProviderfrom Spring Security (the "classic" approach with HTTP sessions "where I create an instance of MarkLogic DatabaseClient, after which a simple request ( testQuery, L. 46 in MarkLogicConnections) is executed to see how the result can be restored, from which it was decided that the login is provided or not.

I am wondering if there is a more elegant solution, but nothing was found in the MarkLogic documentation.

+4
source share
1 answer

You can use this feature to retrieve any user data that you store in the database.

If this is undesirable, maybe there is no need to check the user credentials at all? You can let this lazily on your first mandatory request. And you should be prepared to handle database errors everywhere, anyway.

- , suggest() , . , . getErrorFormat . , , rest-writer rest-admin. , noop XQuery, , ().

+2

All Articles