@ExperimentalApi public class AuthenticatedWebResourceProvider extends Object implements AutoCloseable
WebResource
s for Remote API clients.
Clients should call setAuthContext(String, char[])
to set the active user before making remote requests,
and clearAuthContext()
when the user authentication is no longer needed.
//TODO make this an interface before making public - CRA-627
Constructor and Description |
---|
AuthenticatedWebResourceProvider(com.sun.jersey.api.client.Client client,
String baseUrl,
String path) |
Modifier and Type | Method and Description |
---|---|
void |
clearAuthContext()
Clears the current authenticated user, if any.
|
void |
close() |
static AuthenticatedWebResourceProvider |
createWithNewClient(String baseUrl)
Helper method to create new AuthenticatedWebResourceProviders using a default
client and no extra base WebResource path.
|
String |
getUsername() |
com.sun.jersey.api.client.WebResource.Builder |
newJsonResource(String path)
Returns a new web resource accepting JSON.
|
com.sun.jersey.api.client.WebResource |
newRestWebResource() |
void |
setAuthContext(String username,
char[] password)
Authenticates a user to make remote requests with.
|
public static AuthenticatedWebResourceProvider createWithNewClient(String baseUrl)
public com.sun.jersey.api.client.WebResource newRestWebResource()
public com.sun.jersey.api.client.WebResource.Builder newJsonResource(String path)
public void setAuthContext(String username, char[] password)
username
- the login username of the userpassword
- the password of the userpublic void clearAuthContext()
public String getUsername()
public void close()
close
in interface AutoCloseable
Copyright © 2003–2017 Atlassian. All rights reserved.