|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=CLASS)
@Target(value={METHOD,TYPE})
public @interface RequiresAuthentication
Use on Get, Post, … annotated methods to use authentication
on the request.
RestClientHeaders or add the
following method to your interface :
void setAuthentication(org.springframework.http.HttpAuthentication auth).
You can also add this specific method for Basic
Authentication :
setHttpBasicAuth(String username, String password).
Example :
@Rest(rootUrl = "http://myserver", converters = MappingJacksonHttpMessageConverter.class)
public interface MyRestClient {
@Get("/events/{id}")
@RequiresAuthentication
Event getEvent(long id);
setHttpBasicAuth(String username, String password);
}
@EBean
public class MyBean {
@RestService MyRestClient;
@AfterInject
public void init() {
myRestClient.setHttpBasicAuth("user", "password");
}
}
Rest,
Get,
Post,
Put,
Delete,
Head,
Options
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||