Skip to content

Commit

Permalink
chore: update wrt 4.5.2 and 4.5.3 changes
Browse files Browse the repository at this point in the history
Signed-off-by: jgomer2001 <[email protected]>
  • Loading branch information
jgomer2001 committed Feb 9, 2024
1 parent c2ba9bb commit 78dfb32
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion scim-client-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>scim</artifactId>
<version>4.5.3-SNAPSHOT</version>
<version>4.5.4-SNAPSHOT</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import java.util.*;

import static javax.ws.rs.core.Response.Status.*;
import static jakarta.ws.rs.core.Response.Status.*;

import static org.testng.Assert.*;

Expand Down
2 changes: 1 addition & 1 deletion scim-client/src/test/resources/testng.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</classes>
</test>

<test name="Fido Devices Test" enabled="false">
<test name="Fido Devices Test" enabled="true">
<classes>
<class name="gluu.scim2.client.singleresource.FidoU2fDeviceTest" />
<class name="gluu.scim2.client.singleresource.Fido2DeviceTest" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.gluu.oxtrust.model.scim2.util.DateUtil;

import java.util.regex.Pattern;
import java.time.format.DateTimeFormatter;

/**
* Represents the metadata of an attribute that belongs to a SCIM resource extension.
Expand Down Expand Up @@ -99,8 +100,15 @@ public static Object valueFromString(ExtensionField field, String val){
value = val;
break;
case DATE:
//Dates are stored and read as strings indeed (no handling of Date or DateTime objects)
value=DateUtil.generalizedToISOStringDate(val);
if (value == null) {
try {
DateTimeFormatter.ISO_DATE_TIME.parse(val);
value = val;
} catch (Exception e) {
//Let value be null
}
}
break;
case NUMERIC:
try{
Expand Down Expand Up @@ -213,4 +221,4 @@ public void setDescription(String description) {
this.description = description;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static org.gluu.oxtrust.model.scim2.Constants.USER_EXT_SCHEMA_ID;
import static org.gluu.oxtrust.model.scim2.Constants.USER_EXT_SCHEMA_NAME;

import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -137,34 +136,22 @@ public List<Object> getAttributeValues(ExtensionField field, Collection valuesHo
* asociated to the field: for STRING the value is left as is; for DATE the
* value is converted to a String following the ISO date format; for NUMERIC an
* Integer/Double is created from the value supplied.
* @param ldapBackend Whether the underlying database is an ldap directory
* @param field
* An ExtensionField
* @param strValues
* A non-empty String array with the values associated to the field
* passed. These values are coming from LDAP
* @return List of opaque values
*/
public List<Object> convertValues(ExtensionField field, String strValues[], boolean ldapBackend) {
public List<Object> convertValues(ExtensionField field, String[] strValues) {

List<Object> values = new ArrayList<>();

for (String val : strValues) {
// In practice, there should not be nulls in strValues
if (val != null) {
Object value;

//See org.gluu.oxtrust.model.scim2.util.DateUtil.gluuCouchbaseISODate()
if (!ldapBackend && field.getType().equals(AttributeDataType.DATE)) {
try {
DateTimeFormatter.ISO_DATE_TIME.parse(val);
value = val;
} catch (Exception e) {
value = null;
}
} else {
value = ExtensionField.valueFromString(field, val);
}
Object value = ExtensionField.valueFromString(field, val);

// won't happen either (value being null) because calls to this method occurs
// after lots of validations have taken place
if (value != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ private void transferExtendedAttributesToResource(ScimCustomPerson person, BaseS
log.debug("transferExtendedAttributesToResource. Copying to resource the value(s) for attribute '{}'",
attr);
ExtensionField field = fields.get(attr);
List<Object> convertedValues = extService.convertValues(field, values, ldapBackend);
List<Object> convertedValues = extService.convertValues(field, values);

if (convertedValues.size() > 0) {
map.put(attr, field.isMultiValued() ? convertedValues : convertedValues.get(0));
Expand Down
2 changes: 1 addition & 1 deletion scim-server/src/main/resources/gluu-scim-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ info:
license:
name: Apache 2
url: https://github.com/GluuFederation/scim/blob/master/LICENSE
version: 4.5.0
version: 4.5.4
servers:
- url: https://your.gluu.server.com/identity/restv1/scim/v2
tags:
Expand Down
2 changes: 1 addition & 1 deletion scim-server/src/main/resources/gluu-scim-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
swagger: '2.0'

info:
version: "4.5.0"
version: "4.5.4"
title: SCIM API
description: |
Gluu SCIM 2.0 server API. Developers can think of SCIM as a REST API with endpoints exposing CRUD functionality
Expand Down

0 comments on commit 78dfb32

Please sign in to comment.