public class SyncopeClient extends Object
SyncopeClientFactoryBean
.Constructor and Description |
---|
SyncopeClient(javax.ws.rs.core.MediaType mediaType,
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean restClientFactory,
RestClientExceptionMapper exceptionMapper,
AuthenticationHandler handler,
boolean useCompression,
org.apache.cxf.configuration.jsse.TLSClientParameters tlsClientParameters) |
Modifier and Type | Method and Description |
---|---|
BatchRequest |
batch()
Initiates a new Batch request.
|
protected void |
cleanup() |
SyncopeClient |
delegatedBy(String delegating)
Requests to invoke services as delegating user.
|
static AnyObjectFiqlSearchConditionBuilder |
getAnyObjectSearchConditionBuilder(String type)
Returns a new instance of
AnyObjectFiqlSearchConditionBuilder , for assisted building of FIQL queries. |
static ConnObjectTOFiqlSearchConditionBuilder |
getConnObjectTOFiqlSearchConditionBuilder()
Returns a new instance of
ConnObjectTOFiqlSearchConditionBuilder , for assisted building of FIQL queries. |
String |
getDomain()
Returns the domain configured for this instance, or
SyncopeConstants.MASTER_DOMAIN if not set. |
static GroupFiqlSearchConditionBuilder |
getGroupSearchConditionBuilder()
Returns a new instance of
GroupFiqlSearchConditionBuilder , for assisted building of FIQL queries. |
String |
getJWT()
Returns the JWT in used by this instance, passed with the
HttpHeaders.AUTHORIZATION header
in all requests. |
<T> javax.ws.rs.core.EntityTag |
getLatestEntityTag(T service)
Fetches
ETag header value from latest service run (if available). |
static OrderByClauseBuilder |
getOrderByClauseBuilder()
Returns a new instance of
OrderByClauseBuilder , for assisted building of orderby clauses. |
<T> T |
getService(Class<T> serviceClass)
Creates an instance of the given service class, with configured content type and authentication.
|
static UserFiqlSearchConditionBuilder |
getUserSearchConditionBuilder()
Returns a new instance of
UserFiqlSearchConditionBuilder , for assisted building of FIQL queries. |
<T> T |
header(T service,
String key,
Object... values)
Sets the given header on the give service instance.
|
<T> T |
ifMatch(T service,
javax.ws.rs.core.EntityTag etag)
Sets the
If-Match header on the given service instance. |
<T> T |
ifNoneMatch(T service,
javax.ws.rs.core.EntityTag etag)
Sets the
If-None-Match header on the given service instance. |
protected void |
init(AuthenticationHandler handler)
Initializes the provided
restClientFactory with the authentication capabilities of the provided
handler . |
void |
login(AuthenticationHandler handler)
(Re)initializes the current instance with the authentication capabilities of the provided
handler . |
void |
logout()
Invalidates the JWT currently in use.
|
<T> T |
nullPriorityAsync(T service,
boolean nullPriorityAsync)
Asks for asynchronous propagation towards external resources with null priority.
|
<T> T |
prefer(T service,
Preference preference)
Sets the
Prefer header on the give service instance. |
void |
refresh()
Attempts to extend the lifespan of the JWT currently in use.
|
Triple<Map<String,Set<String>>,List<String>,UserTO> |
self() |
public SyncopeClient(javax.ws.rs.core.MediaType mediaType, org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean restClientFactory, RestClientExceptionMapper exceptionMapper, AuthenticationHandler handler, boolean useCompression, org.apache.cxf.configuration.jsse.TLSClientParameters tlsClientParameters)
protected void init(AuthenticationHandler handler)
restClientFactory
with the authentication capabilities of the provided
handler
.
Currently supports:
More can be supported by subclasses.handler
- authentication handlerprotected void cleanup()
public SyncopeClient delegatedBy(String delegating)
delegating
- delegating usernamepublic void refresh()
public void logout()
public void login(AuthenticationHandler handler)
handler
.handler
- authentication handlerpublic static UserFiqlSearchConditionBuilder getUserSearchConditionBuilder()
UserFiqlSearchConditionBuilder
, for assisted building of FIQL queries.UserFiqlSearchConditionBuilder
public static GroupFiqlSearchConditionBuilder getGroupSearchConditionBuilder()
GroupFiqlSearchConditionBuilder
, for assisted building of FIQL queries.GroupFiqlSearchConditionBuilder
public static AnyObjectFiqlSearchConditionBuilder getAnyObjectSearchConditionBuilder(String type)
AnyObjectFiqlSearchConditionBuilder
, for assisted building of FIQL queries.type
- any typeAnyObjectFiqlSearchConditionBuilder
public static ConnObjectTOFiqlSearchConditionBuilder getConnObjectTOFiqlSearchConditionBuilder()
ConnObjectTOFiqlSearchConditionBuilder
, for assisted building of FIQL queries.ConnObjectTOFiqlSearchConditionBuilder
public static OrderByClauseBuilder getOrderByClauseBuilder()
OrderByClauseBuilder
, for assisted building of orderby
clauses.OrderByClauseBuilder
public String getJWT()
HttpHeaders.AUTHORIZATION
header
in all requests. It can be null (in case NoAuthenticationHandler
or
AnonymousAuthenticationHandler
were used).public String getDomain()
SyncopeConstants.MASTER_DOMAIN
if not set.public <T> T getService(Class<T> serviceClass)
T
- any service classserviceClass
- service class referencepublic <T> T header(T service, String key, Object... values)
T
- any service classservice
- service class instancekey
- HTTP header keyvalues
- HTTP header valuespublic <T> T prefer(T service, Preference preference)
Prefer
header on the give service instance.T
- any service classservice
- service class instancepreference
- preference to be set via Prefer
headerPrefer
header setpublic <T> T nullPriorityAsync(T service, boolean nullPriorityAsync)
T
- any service classservice
- service class instancenullPriorityAsync
- whether asynchronous propagation towards external resources with null priority is
requestedpublic <T> T ifMatch(T service, javax.ws.rs.core.EntityTag etag)
If-Match
header on the given service instance.T
- any service classservice
- service class instanceetag
- ETag valueIf-Match
setpublic <T> T ifNoneMatch(T service, javax.ws.rs.core.EntityTag etag)
If-None-Match
header on the given service instance.T
- any service classservice
- service class instanceetag
- ETag valueIf-None-Match
setpublic <T> javax.ws.rs.core.EntityTag getLatestEntityTag(T service)
ETag
header value from latest service run (if available).T
- any service classservice
- service class instanceETag
header value from latest service run (if available)public BatchRequest batch()
BatchRequest batchRequest = syncopeClient.batch(); batchRequest.getService(UserService.class).create(...); batchRequest.getService(UserService.class).update(...); batchRequest.getService(GroupService.class).update(...); batchRequest.getService(GroupService.class).delete(...); ... BatchResponse batchResponse = batchRequest().commit(); List<BatchResponseItem> items = batchResponse.getItems()
Copyright © 2010–2023 The Apache Software Foundation. All rights reserved.