gluu
公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 限定公開メンバ関数 | 関数 | 変数 | 非公開変数類 | 全メンバ一覧
org.gluu.oxtrust.ws.rs.scim2.GroupWebService クラス
org.gluu.oxtrust.ws.rs.scim2.GroupWebService の継承関係図
Inheritance graph
org.gluu.oxtrust.ws.rs.scim2.GroupWebService 連携図
Collaboration graph

公開メンバ関数

Response createGroup ( @ApiParam(value="Group", required=true) GroupResource group, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
 
Response getGroupById ( @PathParam("id") String id, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
 
Response updateGroup ( @ApiParam(value="Group", required=true) GroupResource group, @PathParam("id") String id, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
 
Response deleteGroup (@PathParam("id") String id)
 
Response searchGroups ( @QueryParam(QUERY_PARAM_FILTER) String filter, @QueryParam(QUERY_PARAM_START_INDEX) Integer startIndex, @QueryParam(QUERY_PARAM_COUNT) Integer count, @QueryParam(QUERY_PARAM_SORT_BY) String sortBy, @QueryParam(QUERY_PARAM_SORT_ORDER) String sortOrder, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
 
Response searchGroupsPost (@ApiParam(value="SearchRequest", required=true) SearchRequest searchRequest)
 
Response patchGroup (PatchRequest request, @PathParam("id") String id, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
 
void setup ()
 
String getEndpointUrl ()
 
Response createGroup (GroupResource group, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
 
Response updateGroup (GroupResource group, @PathParam("id") String id, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
 
Response searchGroupsPost (SearchRequest searchRequest)
 

静的公開メンバ関数

static Response getErrorResponse (Response.Status status, String detail)
 
static Response getErrorResponse (Response.Status status, ErrorScimType scimType, String detail)
 
static Response getErrorResponse (int statusCode, ErrorScimType scimType, String detail)
 

静的公開変数類

static final String SEARCH_SUFFIX = ".search"
 

限定公開メンバ関数

void assignMetaInformation (BaseScimResource resource)
 
void executeDefaultValidation (BaseScimResource resource) throws SCIMException
 
void executeValidation (BaseScimResource resource, boolean skipRequired) throws SCIMException
 
Response prepareSearchRequest (List< String > schemas, String filter, String sortBy, String sortOrder, Integer startIndex, Integer count, String attrsList, String excludedAttrsList, SearchRequest request)
 
Response inspectPatchRequest (PatchRequest patch, Class<? extends BaseScimResource > cls)
 

関数

int getMaxCount ()
 
String getValueFromHeaders (HttpHeaders headers, String name)
 
String translateSortByAttribute (Class<? extends BaseScimResource > cls, String sortBy)
 
String getListResponseSerialized (int total, int startIndex, List< BaseScimResource > resources, String attrsList, String excludedAttrsList, boolean ignoreResults) throws IOException
 

変数

Logger log
 
AppConfiguration appConfiguration
 
ScimResourceSerializer resourceSerializer
 
ExtensionService extService
 
String endpointUrl
 

非公開変数類

UserWebService userWebService
 
Scim2GroupService scim2GroupService
 
IGroupService groupService
 
Scim2PatchService scim2PatchService
 

詳解

Implementation of /Groups endpoint. Methods here are intercepted and/or decorated. Class org.gluu.oxtrust.service.scim2.interceptor.GroupWebServiceDecorator is used to apply pre-validations on data. Filter org.gluu.oxtrust.filter.AuthorizationProcessingFilter secures invocations

著者
Rahat Ali Date: 05.08.2015 Updated by jgomer on 2017-10-18

関数詳解

◆ assignMetaInformation()

void org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.assignMetaInformation ( BaseScimResource  resource)
inlineprotectedinherited
102  {
103 
104  //Generate some meta information (this replaces the info client passed in the request)
105  long now=new Date().getTime();
106  String val= ISODateTimeFormat.dateTime().withZoneUTC().print(now);
107 
108  Meta meta=new Meta();
109  meta.setResourceType(ScimResourceUtil.getType(resource.getClass()));
110  meta.setCreated(val);
111  meta.setLastModified(val);
112  //For version attritute: Service provider support for this attribute is optional and subject to the service provider's support for versioning
113  //For location attribute: this will be set after current user creation in LDAP
114  resource.setMeta(meta);
115 
116  }

◆ createGroup() [1/2]

Response org.gluu.oxtrust.ws.rs.scim2.IGroupWebService.createGroup ( GroupResource  group,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String  attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String  excludedAttrsList 
)
inherited

Service method that allows creating a Group resource via POST (as per section 3.3 of RFC 7644).

引数
groupAn object that represents the Group to create
attrsListSee notes about attributes query param
excludedAttrsListSee notes about excludedAttributes query param
戻り値
An object abstracting the response obtained from the server to this request. A succesful response for this operation should contain a status code of 201 (created) and a GroupResource in the entity body (the resource just created)

◆ createGroup() [2/2]

Response org.gluu.oxtrust.ws.rs.scim2.GroupWebService.createGroup ( @ApiParam(value="Group", required=true) GroupResource  group,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String  attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String  excludedAttrsList 
)
inline
97  {
98 
99  Response response;
100  try {
101  log.debug("Executing web service method. createGroup");
103  String json=resourceSerializer.serialize(group, attrsList, excludedAttrsList);
104  response=Response.created(new URI(group.getMeta().getLocation())).entity(json).build();
105  }
106  catch (Exception e){
107  log.error("Failure at createGroup method", e);
108  response=getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
109  }
110  return response;
111 
112  }
void createGroup(GroupResource group, String groupsUrl, String usersUrl)
Definition: Scim2GroupService.java:172
ScimResourceSerializer resourceSerializer
Definition: BaseScimWebService.java:62
String serialize(BaseScimResource resource, String attributes, String exclusions)
Definition: ScimResourceSerializer.java:203
UserWebService userWebService
Definition: GroupWebService.java:76
String endpointUrl
Definition: BaseScimWebService.java:69
Logger log
Definition: BaseScimWebService.java:56
String getEndpointUrl()
Definition: BaseScimWebService.java:71
Scim2GroupService scim2GroupService
Definition: GroupWebService.java:79
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75

◆ deleteGroup()

Response org.gluu.oxtrust.ws.rs.scim2.GroupWebService.deleteGroup ( @PathParam("id") String  id)
inline

org.gluu.oxtrust.ws.rs.scim2.IGroupWebServiceを実装しています。

190  {
191 
192  Response response;
193  try {
194  log.debug("Executing web service method. deleteGroup");
195  GluuGroup gr=groupService.getGroupByInum(id); //group cannot be null (check associated decorator method)
197  response=Response.noContent().build();
198  }
199  catch (Exception e){
200  log.error("Failure at deleteGroup method", e);
201  response=getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
202  }
203  return response;
204 
205  }
abstract GluuGroup getGroupByInum(String inum)
IGroupService groupService
Definition: GroupWebService.java:82
void deleteGroup(GluuGroup gluuGroup)
Definition: Scim2GroupService.java:224
Logger log
Definition: BaseScimWebService.java:56
Scim2GroupService scim2GroupService
Definition: GroupWebService.java:79
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75

◆ executeDefaultValidation()

void org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.executeDefaultValidation ( BaseScimResource  resource) throws SCIMException
inlineprotectedinherited
118  {
119  executeValidation(resource, false);
120  }
void executeValidation(BaseScimResource resource, boolean skipRequired)
Definition: BaseScimWebService.java:122

◆ executeValidation()

void org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.executeValidation ( BaseScimResource  resource,
boolean  skipRequired 
) throws SCIMException
inlineprotectedinherited
122  {
123 
124  ResourceValidator rv=new ResourceValidator(resource, extService.getResourceExtensions(resource.getClass()));
125  if (!skipRequired){
126  rv.validateRequiredAttributes();
127  rv.validateSchemasAttribute();
128  }
129  rv.validateValidableAttributes();
130  //By section 7 of RFC 7643, we are not forced to constrain attribute values when they have a list of canonical values associated
131  //rv.validateCanonicalizedAttributes();
132  rv.validateExtendedAttributes();
133 
134  }
List< Extension > getResourceExtensions(Class<? extends BaseScimResource > cls)
Definition: ExtensionService.java:46
ExtensionService extService
Definition: BaseScimWebService.java:65

◆ getEndpointUrl()

String org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.getEndpointUrl ( )
inlineinherited
71  {
72  return endpointUrl;
73  }
String endpointUrl
Definition: BaseScimWebService.java:69

◆ getErrorResponse() [1/3]

static Response org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.getErrorResponse ( Response.Status  status,
String  detail 
)
inlinestaticinherited
75  {
76  return getErrorResponse(status.getStatusCode(), null, detail);
77  }
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75

◆ getErrorResponse() [2/3]

static Response org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.getErrorResponse ( Response.Status  status,
ErrorScimType  scimType,
String  detail 
)
inlinestaticinherited
79  {
80  return getErrorResponse(status.getStatusCode(), scimType, detail);
81  }
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75

◆ getErrorResponse() [3/3]

static Response org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.getErrorResponse ( int  statusCode,
ErrorScimType  scimType,
String  detail 
)
inlinestaticinherited
83  {
84 
85  ErrorResponse errorResponse = new ErrorResponse();
86  errorResponse.setStatus(String.valueOf(statusCode));
87  errorResponse.setScimType(scimType);
88  errorResponse.setDetail(detail);
89 
90  return Response.status(statusCode).entity(errorResponse).build();
91  }

◆ getGroupById()

Response org.gluu.oxtrust.ws.rs.scim2.GroupWebService.getGroupById ( @PathParam("id") String  id,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String  attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String  excludedAttrsList 
)
inline

org.gluu.oxtrust.ws.rs.scim2.IGroupWebServiceを実装しています。

125  {
126 
127  Response response;
128  try {
129  log.debug("Executing web service method. getGroupById");
130 
131  GroupResource group=new GroupResource();
132  GluuGroup gluuGroup=groupService.getGroupByInum(id); //gluuGroup is not null (check associated decorator method)
134 
135  String json=resourceSerializer.serialize(group, attrsList, excludedAttrsList);
136  response=Response.ok(new URI(group.getMeta().getLocation())).entity(json).build();
137  }
138  catch (Exception e){
139  log.error("Failure at getGroupById method", e);
140  response=getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
141  }
142  return response;
143  }
abstract GluuGroup getGroupByInum(String inum)
ScimResourceSerializer resourceSerializer
Definition: BaseScimWebService.java:62
IGroupService groupService
Definition: GroupWebService.java:82
String serialize(BaseScimResource resource, String attributes, String exclusions)
Definition: ScimResourceSerializer.java:203
UserWebService userWebService
Definition: GroupWebService.java:76
String endpointUrl
Definition: BaseScimWebService.java:69
Logger log
Definition: BaseScimWebService.java:56
void transferAttributesToGroupResource(GluuGroup gluuGroup, GroupResource res, String groupsUrl, String usersUrl)
Definition: Scim2GroupService.java:123
String getEndpointUrl()
Definition: BaseScimWebService.java:71
Scim2GroupService scim2GroupService
Definition: GroupWebService.java:79
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75

◆ getListResponseSerialized()

String org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.getListResponseSerialized ( int  total,
int  startIndex,
List< BaseScimResource resources,
String  attrsList,
String  excludedAttrsList,
boolean  ignoreResults 
) throws IOException
inlinepackageinherited
203  {
204 
205  ListResponse listResponse = new ListResponse(startIndex, resources.size(), total);
206  listResponse.setResources(resources);
207 
208  ObjectMapper mapper = new ObjectMapper();
209  SimpleModule module = new SimpleModule("ListResponseModule", Version.unknownVersion());
210  module.addSerializer(ListResponse.class, new ListResponseJsonSerializer(resourceSerializer, attrsList, excludedAttrsList, ignoreResults));
211  mapper.registerModule(module);
212 
213  return mapper.writeValueAsString(listResponse);
214 
215  }
ScimResourceSerializer resourceSerializer
Definition: BaseScimWebService.java:62

◆ getMaxCount()

int org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.getMaxCount ( )
inlinepackageinherited
93  {
94  return appConfiguration.getScimProperties().getMaxCount();
95  }
AppConfiguration appConfiguration
Definition: BaseScimWebService.java:59

◆ getValueFromHeaders()

String org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.getValueFromHeaders ( HttpHeaders  headers,
String  name 
)
inlinepackageinherited
97  {
98  List<String> values=headers.getRequestHeaders().get(name);
99  return (values==null || values.size()==0) ? null : values.get(0);
100  }

◆ inspectPatchRequest()

Response org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.inspectPatchRequest ( PatchRequest  patch,
Class<? extends BaseScimResource cls 
)
inlineprotectedinherited
217  {
218 
219  Response response=null;
220  List<String> schemas=patch.getSchemas();
221 
222  if (schemas!=null && schemas.size()==1 && schemas.get(0).equals(PATCH_REQUEST_SCHEMA_ID)) {
223  List<PatchOperation> ops = patch.getOperations();
224 
225  if (ops != null) {
226  //Adjust paths if they came prefixed
227 
228  String defSchema=ScimResourceUtil.getDefaultSchemaUrn(cls);
229  List<String> urns=extService.getUrnsOfExtensions(cls);
230  urns.add(defSchema);
231 
232  for (PatchOperation op : ops){
233  if (op.getPath()!=null)
234  op.setPath(ScimResourceUtil.adjustNotationInPath(op.getPath(), defSchema, urns));
235  }
236 
237  for (PatchOperation op : ops) {
238 
239  if (op.getType() == null)
240  response = getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX, "Operation '" + op.getOperation() + "' not recognized");
241  else {
242  String path = op.getPath();
243 
244  if (StringUtils.isEmpty(path) && op.getType().equals(PatchOperationType.REMOVE))
245  response = getErrorResponse(BAD_REQUEST, ErrorScimType.NO_TARGET, "Path attribute is required for remove operation");
246  else
247  if (op.getValue() == null && !op.getType().equals(PatchOperationType.REMOVE))
248  response = getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX, "Value attribute is required for operations other than remove");
249  }
250  if (response != null)
251  break;
252  }
253  }
254  else
255  response = getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX, "Patch request MUST contain the attribute 'Operations'");
256  }
257  else
258  response = getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX, "Wrong schema(s) supplied in Search Request");
259 
260  log.info("inspectPatchRequest. Preprocessing of patch request {}", response==null ? "passed" : "failed");
261  return response;
262 
263  }
Logger log
Definition: BaseScimWebService.java:56
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75
ExtensionService extService
Definition: BaseScimWebService.java:65
List< String > getUrnsOfExtensions(Class<? extends BaseScimResource > cls)
Definition: ExtensionService.java:86

◆ patchGroup()

Response org.gluu.oxtrust.ws.rs.scim2.GroupWebService.patchGroup ( PatchRequest  request,
@PathParam("id") String  id,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String  attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String  excludedAttrsList 
)
inline

org.gluu.oxtrust.ws.rs.scim2.IGroupWebServiceを実装しています。

283  {
284 
285  Response response;
286  try{
287  log.debug("Executing web service method. patchGroup");
288 
289  String usersUrl=userWebService.getEndpointUrl();
290  GroupResource group=new GroupResource();
291  GluuGroup gluuGroup=groupService.getGroupByInum(id); //group is not null (check associated decorator method)
292 
293  //Fill group instance with all info from gluuGroup
295 
296  //Apply patches one by one in sequence
297  for (PatchOperation po : request.getOperations())
298  group=(GroupResource) scim2PatchService.applyPatchOperation(group, po);
299 
300  //Throws exception if final representation does not pass overall validation
301  log.debug("patchGroup. Revising final resource representation still passes validations");
303 
304  //Update timestamp
305  String now=ISODateTimeFormat.dateTime().withZoneUTC().print(System.currentTimeMillis());
306  group.getMeta().setLastModified(now);
307 
308  //Replaces the information found in gluuGroup with the contents of group
309  scim2GroupService.replaceGroupInfo(gluuGroup, group, endpointUrl, usersUrl);
310 
311  String json=resourceSerializer.serialize(group, attrsList, excludedAttrsList);
312  response=Response.ok(new URI(group.getMeta().getLocation())).entity(json).build();
313  }
314  catch (InvalidAttributeValueException e){
315  log.error(e.getMessage(), e);
316  response=getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.MUTABILITY, e.getMessage());
317  }
318  catch (SCIMException e){
319  response=getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_SYNTAX, e.getMessage());
320  }
321  catch (Exception e){
322  log.error("Failure at patchGroup method", e);
323  response=getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
324  }
325  return response;
326 
327  }
abstract GluuGroup getGroupByInum(String inum)
void replaceGroupInfo(GluuGroup gluuGroup, GroupResource group, String groupsUrl, String usersUrl)
Definition: Scim2GroupService.java:241
ScimResourceSerializer resourceSerializer
Definition: BaseScimWebService.java:62
Scim2PatchService scim2PatchService
Definition: GroupWebService.java:85
IGroupService groupService
Definition: GroupWebService.java:82
void executeDefaultValidation(BaseScimResource resource)
Definition: BaseScimWebService.java:118
String serialize(BaseScimResource resource, String attributes, String exclusions)
Definition: ScimResourceSerializer.java:203
UserWebService userWebService
Definition: GroupWebService.java:76
String endpointUrl
Definition: BaseScimWebService.java:69
Logger log
Definition: BaseScimWebService.java:56
BaseScimResource applyPatchOperation(BaseScimResource resource, PatchOperation operation)
Definition: Scim2PatchService.java:58
void transferAttributesToGroupResource(GluuGroup gluuGroup, GroupResource res, String groupsUrl, String usersUrl)
Definition: Scim2GroupService.java:123
String getEndpointUrl()
Definition: BaseScimWebService.java:71
Scim2GroupService scim2GroupService
Definition: GroupWebService.java:79
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75

◆ prepareSearchRequest()

Response org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.prepareSearchRequest ( List< String >  schemas,
String  filter,
String  sortBy,
String  sortOrder,
Integer  startIndex,
Integer  count,
String  attrsList,
String  excludedAttrsList,
SearchRequest  request 
)
inlineprotectedinherited
167  {
168 
169  Response response=null;
170 
171  if (schemas!=null && schemas.size()==1 && schemas.get(0).equals(SEARCH_REQUEST_SCHEMA_ID)) {
172  count = count == null ? getMaxCount() : count;
173  //Per spec, a negative value SHALL be interpreted as "0" for count
174  if (count<0)
175  count=0;
176 
177  if (count <= getMaxCount()) {
178  startIndex = (startIndex == null || startIndex < 1) ? 1 : startIndex;
179 
180  if (StringUtils.isEmpty(sortOrder) || !sortOrder.equals(SortOrder.DESCENDING.getValue()))
181  sortOrder = SortOrder.ASCENDING.getValue();
182 
183  request.setSchemas(schemas);
184  request.setAttributes(attrsList);
185  request.setExcludedAttributes(excludedAttrsList);
186  request.setFilter(filter);
187  request.setSortBy(sortBy);
188  request.setSortOrder(sortOrder);
189  request.setStartIndex(startIndex);
190  request.setCount(count);
191  }
192  else
193  response = getErrorResponse(BAD_REQUEST, ErrorScimType.TOO_MANY, "Maximum number of results per page is " + getMaxCount());
194  }
195  else
196  response = getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX, "Wrong schema(s) supplied in Search Request");
197 
198  return response;
199 
200  }
int getMaxCount()
Definition: BaseScimWebService.java:93
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75

◆ searchGroups()

Response org.gluu.oxtrust.ws.rs.scim2.GroupWebService.searchGroups ( @QueryParam(QUERY_PARAM_FILTER) String  filter,
@QueryParam(QUERY_PARAM_START_INDEX) Integer  startIndex,
@QueryParam(QUERY_PARAM_COUNT) Integer  count,
@QueryParam(QUERY_PARAM_SORT_BY) String  sortBy,
@QueryParam(QUERY_PARAM_SORT_ORDER) String  sortOrder,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String  attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String  excludedAttrsList 
)
inline

org.gluu.oxtrust.ws.rs.scim2.IGroupWebServiceを実装しています。

220  {
221 
222  Response response;
223  try {
224  log.debug("Executing web service method. searchGroups");
225  sortBy=translateSortByAttribute(GroupResource.class, sortBy);
226  PagedResult<BaseScimResource> resources = scim2GroupService.searchGroups(filter, sortBy, SortOrder.getByValue(sortOrder),
227  startIndex, count, endpointUrl, userWebService.getEndpointUrl(), getMaxCount());
228 
229  String json = getListResponseSerialized(resources.getTotalEntriesCount(), startIndex, resources.getEntries(), attrsList, excludedAttrsList, count==0);
230  response=Response.ok(json).location(new URI(endpointUrl)).build();
231  }
232  catch (SCIMException e){
233  log.error(e.getMessage(), e);
234  response=getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_FILTER, e.getMessage());
235  }
236  catch (Exception e){
237  log.error("Failure at searchGroups method", e);
238  response=getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
239  }
240  return response;
241 
242  }
String getListResponseSerialized(int total, int startIndex, List< BaseScimResource > resources, String attrsList, String excludedAttrsList, boolean ignoreResults)
Definition: BaseScimWebService.java:202
int getMaxCount()
Definition: BaseScimWebService.java:93
UserWebService userWebService
Definition: GroupWebService.java:76
String endpointUrl
Definition: BaseScimWebService.java:69
Logger log
Definition: BaseScimWebService.java:56
String getEndpointUrl()
Definition: BaseScimWebService.java:71
Scim2GroupService scim2GroupService
Definition: GroupWebService.java:79
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75
PagedResult< BaseScimResource > searchGroups(String filter, String sortBy, SortOrder sortOrder, int startIndex, int count, String groupsUrl, String usersUrl, int maxCount)
Definition: Scim2GroupService.java:270
String translateSortByAttribute(Class<? extends BaseScimResource > cls, String sortBy)
Definition: BaseScimWebService.java:137

◆ searchGroupsPost() [1/2]

Response org.gluu.oxtrust.ws.rs.scim2.IGroupWebService.searchGroupsPost ( SearchRequest  searchRequest)
inherited

Sends a search query for Group resources using POST (see section 3.4.3 of RFC 7644).

引数
searchRequestAn object containing the parameters for the query to execute. These are the same parameters passed in the URL for searches, for example in searchDevices
戻り値
An object abstracting the response obtained from the server to this request. A succesful response for this request should contain a status code of 200 and a ListResponse in the entity body (holding a collection of SCIM resources)

org.gluu.oxtrust.service.scim2.interceptor.GroupWebServiceDecoratorで実装されています。

◆ searchGroupsPost() [2/2]

Response org.gluu.oxtrust.ws.rs.scim2.GroupWebService.searchGroupsPost ( @ApiParam(value="SearchRequest", required=true) SearchRequest  searchRequest)
inline
252  {
253 
254  log.debug("Executing web service method. searchGroupsPost");
255 
256  //Calling searchGroups here does not provoke that method's interceptor/decorator being called (only this one's)
257  URI uri=null;
258  Response response = searchGroups(searchRequest.getFilter(), searchRequest.getStartIndex(), searchRequest.getCount(),
259  searchRequest.getSortBy(), searchRequest.getSortOrder(), searchRequest.getAttributesStr(), searchRequest.getExcludedAttributesStr());
260 
261  try {
262  uri = new URI(endpointUrl + "/" + SEARCH_SUFFIX);
263  }
264  catch (Exception e){
265  log.error(e.getMessage(), e);
266  }
267  return Response.fromResponse(response).location(uri).build();
268 
269  }
Response searchGroups( @QueryParam(QUERY_PARAM_FILTER) String filter, @QueryParam(QUERY_PARAM_START_INDEX) Integer startIndex, @QueryParam(QUERY_PARAM_COUNT) Integer count, @QueryParam(QUERY_PARAM_SORT_BY) String sortBy, @QueryParam(QUERY_PARAM_SORT_ORDER) String sortOrder, @QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList, @QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList)
Definition: GroupWebService.java:213
String endpointUrl
Definition: BaseScimWebService.java:69
Logger log
Definition: BaseScimWebService.java:56
static final String SEARCH_SUFFIX
Definition: BaseScimWebService.java:67

◆ setup()

void org.gluu.oxtrust.ws.rs.scim2.GroupWebService.setup ( )
inline
330  {
331  //Do not use getClass() here... a typical weld issue...
332  endpointUrl=appConfiguration.getBaseEndpoint() + GroupWebService.class.getAnnotation(Path.class).value();
333  }
String endpointUrl
Definition: BaseScimWebService.java:69
AppConfiguration appConfiguration
Definition: BaseScimWebService.java:59

◆ translateSortByAttribute()

String org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.translateSortByAttribute ( Class<? extends BaseScimResource cls,
String  sortBy 
)
inlinepackageinherited
137  {
138 
139  String type=ScimResourceUtil.getType(cls);
140  if (StringUtils.isEmpty(sortBy) || type==null)
141  sortBy=null;
142  else {
143  if (extService.extensionOfAttribute(cls, sortBy)==null) { //It's not a custom attribute...
144 
145  sortBy=ScimResourceUtil.stripDefaultSchema(cls, sortBy);
146  Field f=IntrospectUtil.findFieldFromPath(cls, sortBy);
147 
148  if (f==null){ //Not recognized!
149  log.warn("SortBy parameter value '{}' was not recognized as a SCIM attribute for resource {} - sortBy will be ignored.", sortBy, type);
150  sortBy=null;
151  //return getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_PATH, "sortBy parameter value not recognized");
152  }
153  else {
154  sortBy = FilterUtil.getLdapAttributeOfResourceAttribute(sortBy, cls).getFirst();
155  if (sortBy==null)
156  log.warn("There is no LDAP attribute mapping to sortBy attribute provided - sortBy will be ignored.");
157  }
158  }
159  else
160  sortBy = sortBy.substring(sortBy.lastIndexOf(":")+1);
161  }
162  return sortBy;
163 
164  }
Extension extensionOfAttribute(Class<? extends BaseScimResource > cls, String attribute)
Definition: ExtensionService.java:147
Logger log
Definition: BaseScimWebService.java:56
ExtensionService extService
Definition: BaseScimWebService.java:65

◆ updateGroup() [1/2]

Response org.gluu.oxtrust.ws.rs.scim2.IGroupWebService.updateGroup ( GroupResource  group,
@PathParam("id") String  id,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String  attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String  excludedAttrsList 
)
inherited

Service method that allows updating a Group resource via PUT (as per section 3.5.1 of RFC 7644).

This operation is not suitable to delete/remove/nullify attributes. For this purpose you can use the PATCH operation instead. PUT is intended to do replacements using the (not-null) values supplied in fidoDeviceResource parameter.

To learn more about how the update works, read the replacement rules found at ScimResourceUtil#transferToResourceReplace.

引数
groupAn object that contains the data to update on a destination resource. There is no need to supply a full resource, just provide one with the attributes which are intended to be replaced in the destination
idThe "id" attribute of the resource to update (destination)
attrsListSee notes about attributes query param
excludedAttrsListSee notes about excludedAttributes query param
戻り値
An object abstracting the response obtained from the server to this request. A succesful response for this operation should contain a status code of 200 and a GroupResource in the entity body (the resource after the update took place)

◆ updateGroup() [2/2]

Response org.gluu.oxtrust.ws.rs.scim2.GroupWebService.updateGroup ( @ApiParam(value="Group", required=true) GroupResource  group,
@PathParam("id") String  id,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String  attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String  excludedAttrsList 
)
inline

This implementation differs from spec in the following aspects:

  • Passing a null value for an attribute, does not modify the attribute in the destination, however passing an empty array for a multivalued attribute does clear the attribute. Thus, to clear single-valued attribute, PATCH operation should be used
163  {
164 
165  Response response;
166  try {
167  log.debug("Executing web service method. updateGroup");
168  GroupResource updatedResource=scim2GroupService.updateGroup(id, group, endpointUrl, userWebService.getEndpointUrl());
169  String json=resourceSerializer.serialize(updatedResource, attrsList, excludedAttrsList);
170  response=Response.ok(new URI(updatedResource.getMeta().getLocation())).entity(json).build();
171  }
172  catch (InvalidAttributeValueException e){
173  log.error(e.getMessage());
174  response=getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.MUTABILITY, e.getMessage());
175  }
176  catch (Exception e){
177  log.error("Failure at updateGroup method", e);
178  response=getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
179  }
180  return response;
181 
182  }
ScimResourceSerializer resourceSerializer
Definition: BaseScimWebService.java:62
String serialize(BaseScimResource resource, String attributes, String exclusions)
Definition: ScimResourceSerializer.java:203
UserWebService userWebService
Definition: GroupWebService.java:76
String endpointUrl
Definition: BaseScimWebService.java:69
Logger log
Definition: BaseScimWebService.java:56
String getEndpointUrl()
Definition: BaseScimWebService.java:71
Scim2GroupService scim2GroupService
Definition: GroupWebService.java:79
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75
GroupResource updateGroup(String id, GroupResource group, String groupsUrl, String usersUrl)
Definition: Scim2GroupService.java:208

メンバ詳解

◆ appConfiguration

AppConfiguration org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.appConfiguration
packageinherited

◆ endpointUrl

String org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.endpointUrl
packageinherited

◆ extService

ExtensionService org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.extService
packageinherited

◆ groupService

IGroupService org.gluu.oxtrust.ws.rs.scim2.GroupWebService.groupService
private

◆ log

Logger org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.log
packageinherited

◆ resourceSerializer

ScimResourceSerializer org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.resourceSerializer
packageinherited

◆ scim2GroupService

Scim2GroupService org.gluu.oxtrust.ws.rs.scim2.GroupWebService.scim2GroupService
private

◆ scim2PatchService

Scim2PatchService org.gluu.oxtrust.ws.rs.scim2.GroupWebService.scim2PatchService
private

◆ SEARCH_SUFFIX

final String org.gluu.oxtrust.ws.rs.scim2.BaseScimWebService.SEARCH_SUFFIX = ".search"
staticinherited

◆ userWebService

UserWebService org.gluu.oxtrust.ws.rs.scim2.GroupWebService.userWebService
private

このクラス詳解は次のファイルから抽出されました: