Custom Authentication Scenarios

Hi All,

I need to implement security both on the IOS app (Couchbase Lite) and Java Web App (Couchbase Server).
Once the user has been signed up with the plain password, related user document will be created on Couchbase Server through the synch_gateway. iOS app and WebApp will ask credentials and let the user in. Once the user is in, all data provided through the app will be available to him.

So both app needs to authorize users against the related user document in Couchbase Server. The issue is that the password can be stored as encrypted in the document and Java Web App can encypt/decrypt plain password during authentication.

What are the options I have for iOS and Custom Java App to provide authentication using Couchbase capabilities?