Add an authentication filter to check if the user is an admin.
Currently there are only two roles: admin and user. Admin has the permission to some special REST APIs, for example. shutdown.
An HTTP request may contain a basic authentication header with the username and password provided. Any user that is not recognized as an admin will be treated as an ordinary user.
Get the admin password from catalog.
Catalog has it if the password is specified in the deployment.cfg.
Use RolesAllowed.
Also add an API to get the path to the deployment file, restricted to admin only. This is reserved for the watchdog.
Change the shutdown test to check the password.
Return 401 when the user says it's admin with an incorrect password.
Change test to test it.
MasterResource: return a message on successful shutdown

Fix #636
MasterDaemonTest: fix for change to shutdown response content
fixes
remove unused sc
refactor authentication
change enum values of FTMODE and ROLE to uppercase
merge from master
fix tests
remove unnecessary valueOf()
change QueryStatusEncoding.ftMode to enum
To initiate basic auth, the server should respond with a 401 Not Authorized, not a 403 Forbidden (see https://en.wikipedia.org/wiki/Basic_access_authentication)
Merge from master, using Jersey 2 to implement resource access authentication.

Use @NameBinding to bind the admin auth filter only to certain
resources.

If we have a request accessing a resource that requires admin:
Empty auth: UNAUTHORIZED
Non-admin user:
 Wrong password: UNAUTHORIZED (but we don't have this case for now, non-admin users don't need to provide password)
 Correct password: FORBIDDEN (currently always the case for non-admin users)
Admin user:
 Wrong password: UNAUTHORIZED
 Correct password: Pass
MasterDaemonTest: catch and throw the exceptiona instead of timeout.

If an exception was thrown in try{}, such as an AssertionError, it needs
to be exposed. Before this commit, we were simply waiting for the port
to be released in finally{} which would never happen since shutdown was
never called. To do that, catch the exception, shutdown the master
daemon, and put thread checks in finally{}.
Completely remove Jersey 1 from classpath.
When there were multiple versions of Jersey, Java Classloader might pick the wrong one for a certain class name.
oops the tab