Java code to login

Hi Experts,

we are planning to have a custom built web application where we are trying to login to camunda BPM using camunda users by passing username and password.

I looked for examples but could not find any java code to use camunda user for authentication.

Can someone giving me example how i can do it

eg 
public boolean login(String username, String password ) {
// Code goes here which authetication the camunda user ,

// return true/false ;
}

The engine has an authorization service that you can access via Java and there is a isUserAuthorized() method that should do the trick.