Hi,
it's like connecting to ABAP AS via any other method. You have to authenticate before it allows you to execute any FM. For example check this example from SAP documentation.
SAP JCo Scenario: Online Invoice - Components of SAP Communication Technology - SAP Library
Here the web app written in Java is using JCo to connect to ABAP AS. It uses username and password for authentication. So it means it needs to know these for current user. JCo also supports using logon tickets for authentication. In that case the app somehow needs to get the ticket for a user.
Cheers