No annotation means you don't need to be authenticated
@PermitAll means all authenticated users can access the resource
@DenyAll means nobody can access it
@Auth Optional<User> userOpt as path parameter means authentication is not required and gives you a user object, even for anonymous users. Useful to to remove authentication for 1 method when auth is required for the rest of the class
Authenticate using basic auth specifying a username:password. The password is a common one at the moment. When it's valid, your specified username can be used for further authorization.
Password at the moment is 'secret'.
All Create, Update and Delete methods now require authentication.
Examples
Valid authentication:
http -a username:secret localhost:8080/hello-world/auth
Invalid authentication:
http -a username:invalid localhost:8080/hello-world/auth
Using curl:
curl -u username:secret localhost:8080/hello-world/auth
also fix a classname lookup on a 404.
Usage in code
No annotation means you don't need to be authenticated
@PermitAll
means all authenticated users can access the resource@DenyAll
means nobody can access it@Auth Optional<User> userOpt
as path parameter means authentication is not required and gives you a user object, even for anonymous users. Useful to to remove authentication for 1 method when auth is required for the rest of the classFor more see the docs https://www.dropwizard.io/en/latest/manual/auth.html
Using the api
Authenticate using basic auth specifying a username:password. The password is a common one at the moment. When it's valid, your specified username can be used for further authorization. Password at the moment is 'secret'. All Create, Update and Delete methods now require authentication.
Examples
Valid authentication:
http -a username:secret localhost:8080/hello-world/auth
Invalid authentication:
http -a username:invalid localhost:8080/hello-world/auth
Using curl:
curl -u username:secret localhost:8080/hello-world/auth