@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Authorization
The annotation value contains the class wich implement these rules.
For instance :
@GET
@Authorization(AuthorizationAlwaysTrue.class)
public String shouldHaveUsedWithoutAuthentication() {
return "My Public Information";
}
As you can see in the example, AuthorizationAlwaysTrue will be the authorization class which is in charge of
validating authorization.
An authorization class must only define a authorized method which return a boolean value.
For instance :
public class AuthorizationAlwaysTrue {
public boolean authorized() {
return true;
}
}
AuthorizationParameterpublic abstract Class value
Copyright © 2019. All rights reserved.