diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiConstants.java b/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiConstants.java
index b19a1fb3d60..facc83c3a67 100644
--- a/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiConstants.java
+++ b/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiConstants.java
@@ -141,7 +141,7 @@ private ApiConstants() {}
public static final String TOTAL_ITEMS = "totalItems";
public static final String ENTRIES_COUNT = "entriesCount";
public static final String DATA = "data";
-
+ public static final String FIELD_VALUE_PAIR = "fieldValuePair";
}
\ No newline at end of file
diff --git a/jans-config-api/docs/jans-config-api-swagger.yaml b/jans-config-api/docs/jans-config-api-swagger.yaml
index d1d5da621d4..3f3d9974289 100644
--- a/jans-config-api/docs/jans-config-api-swagger.yaml
+++ b/jans-config-api/docs/jans-config-api-swagger.yaml
@@ -834,6 +834,16 @@ paths:
schema:
type: string
default: ascending
+ - name: fieldValuePair
+ in: query
+ description: Field and value pair for seraching
+ schema:
+ type: string
+ default: ""
+ examples:
+ Field value example:
+ description: Field value example
+ value: "adminCanEdit=true,dataType=string"
responses:
"200":
description: Ok
@@ -2028,7 +2038,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/clientAuthMapSchema'
+ $ref: '#/components/schemas/ClientAuth'
examples:
Response json example:
description: Response json example
@@ -2163,12 +2173,24 @@ paths:
description: Attribute whose value will be used to order the returned response
schema:
type: string
+ default: inum
- name: sortOrder
in: query
description: Order in which the sortBy param is applied. Allowed values are
"ascending" and "descending"
schema:
type: string
+ default: ascending
+ - name: fieldValuePair
+ in: query
+ description: Field and value pair for seraching
+ schema:
+ type: string
+ default: ""
+ examples:
+ Field value example:
+ description: Field value example
+ value: "applicationType=web,persistClientAuthorizations=true"
responses:
"200":
description: Ok
@@ -3325,6 +3347,8 @@ paths:
"baseDn": "inum=1800.768b3d38-a6e8-4be4-93d1-72df33d34fd6,ou=clients,o=jans",
"inum": "1800.768b3d38-a6e8-4be4-93d1-72df33d34fd6"
}
+ "400":
+ description: Bad Request
"401":
description: Unauthorized
"500":
@@ -3912,7 +3936,7 @@ paths:
get:
tags:
- Custom Scripts
- summary: Fetch custom script by name
+ summary: Gets a list of custom scripts
description: Gets a list of custom scripts
operationId: get-config-scripts
parameters:
@@ -3949,6 +3973,16 @@ paths:
schema:
type: string
default: ascending
+ - name: fieldValuePair
+ in: query
+ description: Field and value pair for seraching
+ schema:
+ type: string
+ default: ""
+ examples:
+ Field value example:
+ description: Field value example
+ value: "adminCanEdit=true,dataType=string"
responses:
"200":
description: Ok
@@ -4409,6 +4443,16 @@ paths:
schema:
type: string
default: ascending
+ - name: fieldValuePair
+ in: query
+ description: Field and value pair for seraching
+ schema:
+ type: string
+ default: ""
+ examples:
+ Field value example:
+ description: Field value example
+ value: "adminCanEdit=true,dataType=string"
responses:
"200":
description: Ok
@@ -5497,12 +5541,14 @@ paths:
description: Attribute whose value will be used to order the returned response
schema:
type: string
+ default: inum
- name: sortOrder
in: query
description: Order in which the sortBy param is applied. Allowed values are
"ascending" and "descending"
schema:
type: string
+ default: ascending
- name: withAssociatedClients
in: query
description: Boolean fag to indicate if clients associated with the scope
@@ -5510,6 +5556,16 @@ paths:
schema:
type: boolean
default: false
+ - name: fieldValuePair
+ in: query
+ description: Field and value pair for seraching
+ schema:
+ type: string
+ default: ""
+ examples:
+ Field value example:
+ description: Field value example
+ value: "scopeType=spontaneous,defaultScope=true"
responses:
"200":
description: Ok
@@ -7103,12 +7159,24 @@ paths:
description: Attribute whose value will be used to order the returned response
schema:
type: string
+ default: inum
- name: sortOrder
in: query
description: Order in which the sortBy param is applied. Allowed values are
"ascending" and "descending"
schema:
type: string
+ default: ascending
+ - name: fieldValuePair
+ in: query
+ description: Field and value pair for seraching
+ schema:
+ type: string
+ default: ""
+ examples:
+ Field value example:
+ description: Field value example
+ value: deletable=true
responses:
"200":
description: Ok
@@ -7511,13 +7579,6 @@ components:
type: array
items:
$ref: '#/components/schemas/Status'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Status:
type: object
properties:
@@ -7527,13 +7588,6 @@ components:
type: string
error:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
FacterData:
type: object
properties:
@@ -7551,13 +7605,6 @@ components:
type: string
load_average:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
StatsData:
type: object
properties:
@@ -7568,25 +7615,11 @@ components:
format: date-time
facterData:
$ref: '#/components/schemas/FacterData'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AuthenticationMethod:
type: object
properties:
defaultAcr:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Deployment:
type: object
properties:
@@ -7608,13 +7641,6 @@ components:
$ref: '#/components/schemas/DeploymentDetails'
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
DeploymentDetails:
type: object
properties:
@@ -7634,13 +7660,6 @@ components:
type: string
projectMetadata:
$ref: '#/components/schemas/ProjectMetadata'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
ProjectMetadata:
type: object
properties:
@@ -7658,13 +7677,6 @@ components:
type: object
additionalProperties:
type: object
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
PagedResult:
type: object
properties:
@@ -7681,13 +7693,6 @@ components:
type: array
items:
type: object
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Flow:
type: object
properties:
@@ -7712,13 +7717,6 @@ components:
type: string
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
FlowMetadata:
type: object
properties:
@@ -7744,23 +7742,8 @@ components:
type: object
additionalProperties:
type: object
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
JsonPatch:
type: object
- properties:
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AttributeValidation:
type: object
properties:
@@ -7772,13 +7755,6 @@ components:
format: int32
regexp:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
GluuAttribute:
required:
- dataType
@@ -7881,29 +7857,22 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
- whitePagesCanView:
+ userCanAccess:
type: boolean
adminCanView:
type: boolean
- adminCanAccess:
+ userCanView:
type: boolean
- adminCanEdit:
+ adminCanAccess:
type: boolean
userCanEdit:
type: boolean
- userCanAccess:
+ adminCanEdit:
type: boolean
- userCanView:
+ whitePagesCanView:
type: boolean
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
PatchRequest:
type: object
properties:
@@ -7913,13 +7882,6 @@ components:
type: string
value:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AppConfiguration:
type: object
properties:
@@ -8634,6 +8596,8 @@ components:
type: object
additionalProperties:
type: string
+ fapi:
+ type: boolean
allResponseTypesSupported:
uniqueItems: true
type: array
@@ -8643,15 +8607,6 @@ components:
- code
- token
- id_token
- fapi:
- type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AuthenticationFilter:
required:
- baseDn
@@ -8670,13 +8625,6 @@ components:
type: string
xml:
name: base-dn
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AuthenticationProtectionConfiguration:
type: object
properties:
@@ -8691,13 +8639,6 @@ components:
format: int32
bruteForceProtectionEnabled:
type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AuthorizationRequestCustomParameter:
type: object
properties:
@@ -8705,13 +8646,6 @@ components:
type: string
returnInResponse:
type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
CIBAEndUserNotificationConfig:
type: object
properties:
@@ -8735,13 +8669,6 @@ components:
type: string
publicVapidKey:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
ClientAuthenticationFilter:
required:
- baseDn
@@ -8760,13 +8687,6 @@ components:
type: string
xml:
name: base-dn
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
CorsConfigurationFilter:
type: object
properties:
@@ -8791,13 +8711,6 @@ components:
format: int32
corsRequestDecorate:
type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
EngineConfig:
type: object
properties:
@@ -8833,23 +8746,8 @@ components:
type: object
additionalProperties:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
JsonNode:
type: object
- properties:
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SsaConfiguration:
type: object
properties:
@@ -8864,13 +8762,6 @@ components:
ssaExpirationInDays:
type: integer
format: int32
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SsaValidationConfig:
type: object
properties:
@@ -8908,25 +8799,11 @@ components:
type: string
sharedSecret:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
PersistenceConfiguration:
type: object
properties:
persistenceType:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
CacheConfiguration:
type: object
properties:
@@ -8945,26 +8822,12 @@ components:
$ref: '#/components/schemas/RedisConfiguration'
nativePersistenceConfiguration:
$ref: '#/components/schemas/NativePersistenceConfiguration'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
InMemoryConfiguration:
type: object
properties:
defaultPutExpiration:
type: integer
format: int32
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
MemcachedConfiguration:
type: object
properties:
@@ -8984,13 +8847,6 @@ components:
enum:
- DEFAULT
- BINARY
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
NativePersistenceConfiguration:
type: object
properties:
@@ -9004,13 +8860,6 @@ components:
type: boolean
disableAttemptUpdateBeforeInsert:
type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
RedisConfiguration:
type: object
properties:
@@ -9055,13 +8904,91 @@ components:
maxRetryAttempts:
type: integer
format: int32
- clientAuthMapSchema:
+ ClientAuth:
+ type: object
+ properties:
+ clientAuths:
type: object
additionalProperties:
+ uniqueItems: true
type: array
items:
$ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
+ Scope:
+ type: object
+ properties:
+ dn:
+ type: string
+ expirationDate:
+ type: string
+ format: date-time
+ deletable:
+ type: boolean
+ inum:
+ type: string
+ displayName:
+ type: string
+ id:
+ type: string
+ iconUrl:
+ type: string
+ description:
+ type: string
+ scopeType:
+ type: string
+ enum:
+ - openid
+ - dynamic
+ - uma
+ - spontaneous
+ - oauth
+ claims:
+ type: array
+ items:
+ type: string
+ defaultScope:
+ type: boolean
+ groupClaims:
+ type: boolean
+ dynamicScopeScripts:
+ type: array
+ items:
+ type: string
+ umaAuthorizationPolicies:
+ type: array
+ items:
+ type: string
+ attributes:
+ $ref: '#/components/schemas/ScopeAttributes'
+ creatorId:
+ type: string
+ creatorType:
+ type: string
+ enum:
+ - none
+ - client
+ - user
+ - auto
+ creationDate:
+ type: string
+ format: date-time
+ creatorAttributes:
+ type: object
+ additionalProperties:
+ type: string
+ umaType:
+ type: boolean
+ baseDn:
+ type: string
+ ScopeAttributes:
+ type: object
+ properties:
+ spontaneousClientScopes:
+ type: array
+ items:
+ type: string
+ showInConfigurationEndpoint:
+ type: boolean
Client:
type: object
properties:
@@ -9316,13 +9243,6 @@ components:
type: string
inum:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
ClientAttributes:
type: object
properties:
@@ -9415,13 +9335,6 @@ components:
type: array
items:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
CustomObjectAttribute:
type: object
properties:
@@ -9433,17 +9346,10 @@ components:
type: array
items:
type: object
- displayValue:
- type: string
value:
type: object
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
+ displayValue:
+ type: string
LocalizedString:
type: object
properties:
@@ -9451,13 +9357,6 @@ components:
type: object
additionalProperties:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AgamaConfiguration:
type: object
properties:
@@ -9469,13 +9368,6 @@ components:
type: array
items:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
ApiAppConfiguration:
type: object
properties:
@@ -9542,13 +9434,6 @@ components:
type: array
items:
$ref: '#/components/schemas/PluginConf'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AuditLogConf:
type: object
properties:
@@ -9562,13 +9447,6 @@ components:
type: array
items:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
DataFormatConversionConf:
type: object
properties:
@@ -9578,13 +9456,6 @@ components:
type: array
items:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
PluginConf:
type: object
properties:
@@ -9594,16 +9465,11 @@ components:
type: string
className:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SmtpConfiguration:
type: object
properties:
+ valid:
+ type: boolean
connectProtectionList:
type: array
items:
@@ -9612,8 +9478,6 @@ components:
- None
- StartTls
- SslTls
- valid:
- type: boolean
host:
type: string
port:
@@ -9645,13 +9509,6 @@ components:
type: string
signing_algorithm:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SmtpTest:
type: object
properties:
@@ -9661,13 +9518,6 @@ components:
type: string
message:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
CustomScript:
type: object
properties:
@@ -9752,13 +9602,6 @@ components:
type: string
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
ScriptError:
type: object
properties:
@@ -9767,13 +9610,6 @@ components:
format: date-time
stackTrace:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SimpleCustomProperty:
type: object
properties:
@@ -9783,13 +9619,6 @@ components:
type: string
description:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SimpleExtendedCustomProperty:
type: object
properties:
@@ -9801,13 +9630,6 @@ components:
type: boolean
description:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
JSONWebKey:
type: object
properties:
@@ -9892,13 +9714,6 @@ components:
- "KeyOps{value='connect'} CONNECT"
- "KeyOps{value='ssa'} SSA"
- "KeyOps{value='all'} ALL"
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
WebKeysConfiguration:
type: object
properties:
@@ -9906,13 +9721,6 @@ components:
type: array
items:
$ref: '#/components/schemas/JSONWebKey'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
GluuLdapConfiguration:
type: object
properties:
@@ -9949,13 +9757,6 @@ components:
level:
type: integer
format: int32
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Logging:
type: object
properties:
@@ -9976,13 +9777,6 @@ components:
type: array
items:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
GluuOrganization:
required:
- description
@@ -10030,102 +9824,6 @@ components:
type: string
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
- Scope:
- type: object
- properties:
- dn:
- type: string
- expirationDate:
- type: string
- format: date-time
- deletable:
- type: boolean
- inum:
- type: string
- displayName:
- type: string
- id:
- type: string
- iconUrl:
- type: string
- description:
- type: string
- scopeType:
- type: string
- enum:
- - openid
- - dynamic
- - uma
- - spontaneous
- - oauth
- claims:
- type: array
- items:
- type: string
- defaultScope:
- type: boolean
- groupClaims:
- type: boolean
- dynamicScopeScripts:
- type: array
- items:
- type: string
- umaAuthorizationPolicies:
- type: array
- items:
- type: string
- attributes:
- $ref: '#/components/schemas/ScopeAttributes'
- creatorId:
- type: string
- creatorType:
- type: string
- enum:
- - none
- - client
- - user
- - auto
- creationDate:
- type: string
- format: date-time
- creatorAttributes:
- type: object
- additionalProperties:
- type: string
- umaType:
- type: boolean
- baseDn:
- type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
- ScopeAttributes:
- type: object
- properties:
- spontaneousClientScopes:
- type: array
- items:
- type: string
- showInConfigurationEndpoint:
- type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
CustomScope:
type: object
properties:
@@ -10196,13 +9894,6 @@ components:
type: boolean
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SessionId:
type: object
properties:
@@ -10256,13 +9947,6 @@ components:
format: int32
opbrowserState:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SessionIdAccessMap:
type: object
properties:
@@ -10272,13 +9956,6 @@ components:
type: boolean
xml:
name: map
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
User:
type: object
properties:
@@ -10308,13 +9985,6 @@ components:
type: string
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
UmaResource:
required:
- name
@@ -10361,13 +10031,6 @@ components:
ttl:
type: integer
format: int32
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
securitySchemes:
oauth2:
type: oauth2
diff --git a/jans-config-api/plugins/docs/fido2-plugin-swagger.yaml b/jans-config-api/plugins/docs/fido2-plugin-swagger.yaml
index 21f7ee5a3f9..3f1df9fe063 100644
--- a/jans-config-api/plugins/docs/fido2-plugin-swagger.yaml
+++ b/jans-config-api/plugins/docs/fido2-plugin-swagger.yaml
@@ -136,13 +136,6 @@ components:
type: boolean
fido2Configuration:
$ref: '#/components/schemas/Fido2Configuration'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Fido2Configuration:
type: object
properties:
@@ -174,13 +167,6 @@ components:
type: array
items:
$ref: '#/components/schemas/RequestedParty'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
RequestedParty:
type: object
properties:
@@ -190,13 +176,6 @@ components:
type: array
items:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Fido2DeviceData:
type: object
properties:
@@ -221,13 +200,6 @@ components:
type: string
push_token:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Fido2RegistrationData:
type: object
properties:
@@ -276,13 +248,6 @@ components:
format: int32
applicationId:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
Fido2RegistrationEntry:
type: object
properties:
@@ -340,13 +305,6 @@ components:
writeOnly: true
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
securitySchemes:
oauth2:
type: oauth2
diff --git a/jans-config-api/plugins/docs/jans-admin-ui-plugin-swagger.yaml b/jans-config-api/plugins/docs/jans-admin-ui-plugin-swagger.yaml
index ba4faa04a46..3fbc8d4d8e2 100644
--- a/jans-config-api/plugins/docs/jans-admin-ui-plugin-swagger.yaml
+++ b/jans-config-api/plugins/docs/jans-admin-ui-plugin-swagger.yaml
@@ -629,13 +629,6 @@ components:
properties:
licenseKey:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
LicenseApiResponse:
type: object
properties:
@@ -646,13 +639,6 @@ components:
responseCode:
type: integer
format: int32
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
LicenseResponse:
type: object
properties:
@@ -681,25 +667,11 @@ components:
type: string
customerLastName:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
SSARequest:
type: object
properties:
ssa:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AdminPermission:
type: object
properties:
@@ -709,13 +681,6 @@ components:
type: string
defaultPermissionInToken:
type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
RolePermissionMapping:
type: object
properties:
@@ -725,13 +690,6 @@ components:
type: array
items:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
AdminRole:
type: object
properties:
@@ -741,13 +699,6 @@ components:
type: string
deletable:
type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
securitySchemes:
oauth2:
type: oauth2
diff --git a/jans-config-api/plugins/docs/scim-plugin-swagger.yaml b/jans-config-api/plugins/docs/scim-plugin-swagger.yaml
index 963ef455b1e..daadeebcccc 100644
--- a/jans-config-api/plugins/docs/scim-plugin-swagger.yaml
+++ b/jans-config-api/plugins/docs/scim-plugin-swagger.yaml
@@ -115,23 +115,8 @@ components:
type: boolean
useLocalCache:
type: boolean
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
JsonPatch:
type: object
- properties:
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
securitySchemes:
oauth2:
type: oauth2
diff --git a/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml b/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml
index c0d49cadbc6..15718369383 100644
--- a/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml
+++ b/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml
@@ -49,12 +49,24 @@ paths:
description: Attribute whose value will be used to order the returned response
schema:
type: string
+ default: inum
- name: sortOrder
in: query
description: Order in which the sortBy param is applied. Allowed values are
"ascending" and "descending"
schema:
type: string
+ default: ascending
+ - name: fieldValuePair
+ in: query
+ description: Field and value pair for seraching
+ schema:
+ type: string
+ default: ""
+ examples:
+ Field value example:
+ description: Field value example
+ value: "mail=abc@mail.com,jansStatus=true"
responses:
"200":
description: Ok
@@ -830,13 +842,6 @@ components:
type: object
displayValue:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
CustomUser:
type: object
properties:
@@ -878,13 +883,6 @@ components:
type: string
baseDn:
type: string
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
UserPagedResult:
type: object
properties:
@@ -901,13 +899,6 @@ components:
type: array
items:
$ref: '#/components/schemas/CustomUser'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
UserPatchRequest:
type: object
properties:
@@ -917,13 +908,6 @@ components:
type: array
items:
$ref: '#/components/schemas/CustomObjectAttribute'
- clientAuthMapSchema:
- type: object
- additionalProperties:
- type: array
- items:
- $ref: '#/components/schemas/Scope'
- description: clientAuthMapSchema
securitySchemes:
oauth2:
type: oauth2
diff --git a/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/rest/UserResource.java b/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/rest/UserResource.java
index c66ce1f274d..b1514b11e50 100644
--- a/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/rest/UserResource.java
+++ b/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/rest/UserResource.java
@@ -11,7 +11,7 @@
import io.jans.configapi.plugin.mgt.util.MgtUtil;
import io.jans.configapi.util.ApiAccessConstants;
import io.jans.configapi.util.ApiConstants;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.model.PagedResult;
import io.jans.util.StringHelper;
import jakarta.enterprise.context.ApplicationScoped;
@@ -80,16 +80,18 @@ public Response getUsers(
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Search pattern") @DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@Parameter(description = "The 1-based index of the first query result") @DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
- @Parameter(description = "Attribute whose value will be used to order the returned response") @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
- @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder)
+ @Parameter(description = "Attribute whose value will be used to order the returned response") @DefaultValue(ApiConstants.INUM) @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
+ @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
+ @Parameter(description = "Field and value pair for seraching", examples = @ExampleObject(name = "Field value example", value = "mail=abc@mail.com,jansStatus=true")) @DefaultValue("") @QueryParam(value = ApiConstants.FIELD_VALUE_PAIR) String fieldValuePair)
throws IllegalAccessException, InvocationTargetException {
if (logger.isInfoEnabled()) {
- logger.info("User search param - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}",
+ logger.info("User search param - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}, fieldValuePair:{}",
escapeLog(limit), escapeLog(pattern), escapeLog(startIndex), escapeLog(sortBy),
- escapeLog(sortOrder));
+ escapeLog(sortOrder),escapeLog(fieldValuePair));
}
+
SearchRequest searchReq = createSearchRequest(userMgmtSrv.getPeopleBaseDn(), pattern, sortBy, sortOrder,
- startIndex, limit, null, userMgmtSrv.getUserExclusionAttributesAsString(), mgtUtil.getRecordMaxCount());
+ startIndex, limit, null, userMgmtSrv.getUserExclusionAttributesAsString(), mgtUtil.getRecordMaxCount(), fieldValuePair, CustomUser.class);
return Response.ok(this.doSearch(searchReq, true)).build();
}
diff --git a/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/service/UserMgmtService.java b/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/service/UserMgmtService.java
index e7496e4fc26..9f7f0f87fd6 100644
--- a/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/service/UserMgmtService.java
+++ b/jans-config-api/plugins/user-mgt-plugin/src/main/java/io/jans/configapi/plugin/mgt/service/UserMgmtService.java
@@ -11,7 +11,7 @@
import io.jans.configapi.plugin.mgt.util.MgtUtil;
import io.jans.configapi.util.AuthUtil;
import io.jans.configapi.service.auth.ConfigurationService;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.PersistenceEntryManager;
import io.jans.orm.model.PagedResult;
import io.jans.orm.model.SortOrder;
diff --git a/jans-config-api/pom.xml b/jans-config-api/pom.xml
index 7a9a7bc9df1..f4ab921d80c 100644
--- a/jans-config-api/pom.xml
+++ b/jans-config-api/pom.xml
@@ -43,7 +43,7 @@
5.0.1
0.9.5
- 1.33
+ 2.0
5.7.0
3.8.0
0.8.5
diff --git a/jans-config-api/profiles/local/test.properties b/jans-config-api/profiles/local/test.properties
index d069e7f2b10..f8ccbda863e 100644
--- a/jans-config-api/profiles/local/test.properties
+++ b/jans-config-api/profiles/local/test.properties
@@ -4,6 +4,6 @@ test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/con
# jans.server
token.endpoint=https://jans.server1/jans-auth/restv1/token
token.grant.type=client_credentials
-test.client.id=1800.3bcf5241-5ac2-4917-a69a-59bbbdd75f0e
-test.client.secret=JKlsZdTcCCZL
-test.issuer=https://jans.server1/
\ No newline at end of file
+test.client.id=1800.52eb1bed-ab5c-4ba6-b87e-90aad26058d0
+test.client.secret=7ETCiOy3jrmq
+test.issuer=https://jans.server1/
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/filters/SpecFilter.java b/jans-config-api/server/src/main/java/io/jans/configapi/filters/SpecFilter.java
index 3420bf0717d..59d6deab297 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/filters/SpecFilter.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/filters/SpecFilter.java
@@ -8,9 +8,6 @@
import io.swagger.v3.oas.models.media.MediaType;
import io.swagger.v3.oas.models.Operation;
-import io.swagger.v3.oas.models.media.ArraySchema;
-import io.swagger.v3.oas.models.media.Schema;
-import io.swagger.v3.oas.models.media.MapSchema;
import io.swagger.v3.oas.models.responses.*;
import io.swagger.v3.oas.models.examples.Example;
import io.swagger.v3.core.filter.AbstractSpecFilter;
@@ -23,9 +20,6 @@
import org.apache.commons.lang.StringUtils;
-import io.jans.as.common.model.registration.Client;
-import io.jans.as.persistence.model.Scope;
-
public class SpecFilter extends AbstractSpecFilter {
@Override
@@ -45,16 +39,6 @@ public Optional filterOperation(Operation operation, ApiDescription a
return Optional.of(operation);
}
- @Override
- public Optional filterSchema(Schema schema, Map params, Map cookies, Map headers) {
-
- Schema clientAuthMapSchema = new MapSchema().description("clientAuthMapSchema")
- .additionalProperties(new ArraySchema().items(new Schema().$ref("#/components/schemas/Scope")));
- schema.addProperty("clientAuthMapSchema", clientAuthMapSchema);
-
- return Optional.of(schema);
- }
-
private void setRequestExample(Operation operation) {
// request example
if (operation != null && operation.getRequestBody() != null
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AgamaResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AgamaResource.java
index 84bd3cacd1d..5d0d012c0cd 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AgamaResource.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AgamaResource.java
@@ -21,7 +21,7 @@
import io.jans.configapi.service.auth.AgamaFlowService;
import io.jans.configapi.util.ApiAccessConstants;
import io.jans.configapi.util.ApiConstants;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.exception.EntryPersistenceException;
import io.jans.orm.model.PagedResult;
@@ -87,7 +87,7 @@ public Response getFlows(@Parameter(description = "Search pattern") @DefaultValu
}
SearchRequest searchReq = createSearchRequest(agamaFlowService.getAgamaFlowDn(null), pattern, sortBy, sortOrder,
- startIndex, limit, null, null, this.getMaxCount());
+ startIndex, limit, null, null, this.getMaxCount(), null, Flow.class);
return Response.ok(doSearch(searchReq, includeSource)).build();
}
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AttributesResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AttributesResource.java
index 2741c4b5921..e7efe731407 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AttributesResource.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AttributesResource.java
@@ -9,7 +9,7 @@
import com.github.fge.jsonpatch.JsonPatchException;
import io.jans.configapi.core.model.PatchRequest;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.configapi.core.rest.ProtectedApi;
import io.jans.configapi.service.auth.AttributeService;
import io.jans.configapi.util.ApiAccessConstants;
@@ -77,17 +77,18 @@ public Response getAttributes(
@Parameter(description = "Status of the attribute") @DefaultValue(ApiConstants.ALL) @QueryParam(value = ApiConstants.STATUS) String status,
@Parameter(description = "The 1-based index of the first query result") @DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
@Parameter(description = "Attribute whose value will be used to order the returned response") @DefaultValue(ApiConstants.INUM) @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
- @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder) {
+ @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
+ @Parameter(description = "Field and value pair for seraching", examples = @ExampleObject(name = "Field value example", value = "adminCanEdit=true,dataType=string")) @DefaultValue("") @QueryParam(value = ApiConstants.FIELD_VALUE_PAIR) String fieldValuePair) {
if (logger.isDebugEnabled()) {
logger.debug(
- "Search Attribute filters with limit:{}, pattern:{}, status:{}, startIndex:{}, sortBy:{}, sortOrder:{}",
+ "Search Attribute filters with limit:{}, pattern:{}, status:{}, startIndex:{}, sortBy:{}, sortOrder:{}, fieldValuePair:{}",
escapeLog(limit), escapeLog(pattern), escapeLog(status), escapeLog(startIndex), escapeLog(sortBy),
- escapeLog(sortOrder));
+ escapeLog(sortOrder), escapeLog(fieldValuePair));
}
-
+
SearchRequest searchReq = createSearchRequest(attributeService.getDnForAttribute(null), pattern, sortBy,
- sortOrder, startIndex, limit, null, null, this.getMaxCount());
+ sortOrder, startIndex, limit, null, null, this.getMaxCount(),fieldValuePair, GluuAttribute.class);
return Response.ok(doSearch(searchReq, status)).build();
}
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientAuthResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientAuthResource.java
index 2b234a31652..c5694976231 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientAuthResource.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientAuthResource.java
@@ -6,15 +6,13 @@
package io.jans.configapi.rest.resource.auth;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
import static io.jans.as.model.util.Util.escapeLog;
import io.jans.as.common.model.registration.Client;
import io.jans.as.persistence.model.Scope;
import io.jans.configapi.core.rest.ProtectedApi;
+import io.jans.configapi.core.model.ClientAuth;
import io.jans.configapi.service.auth.ClientAuthService;
-
import io.jans.configapi.util.ApiAccessConstants;
import io.jans.configapi.util.ApiConstants;
@@ -48,7 +46,7 @@ public class ClientAuthResource extends ConfigBaseResource {
"Client Authorization" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.CLIENT_AUTHORIZATIONS_READ_ACCESS }))
@ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "Ok", content = @Content(schema = @Schema(ref = "#/components/schemas/clientAuthMapSchema"), examples = @ExampleObject(name = "Response json example", value = "example/client-auth/client-auth-get.json"))),
+ @ApiResponse(responseCode = "200", description = "Ok", content = @Content(schema = @Schema(implementation = ClientAuth.class), examples = @ExampleObject(name = "Response json example", value = "example/client-auth/client-auth-get.json"))),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@GET
@@ -64,6 +62,10 @@ public Response getClientAuthorization(
Map> clientAuths = clientAuthService.getUserAuthorizations(userId);
logger.info("Client serach param - clientAuths:{}", clientAuths);
+
+ ClientAuth clientAuth = new ClientAuth();
+ clientAuth.setClientAuths(clientAuths);
+
return Response.ok(clientAuths).build();
}
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientsResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientsResource.java
index 0de753f1f22..59764761b06 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientsResource.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ClientsResource.java
@@ -14,7 +14,7 @@
import io.jans.as.common.service.common.InumService;
import io.jans.as.persistence.model.Scope;
import io.jans.configapi.core.rest.ProtectedApi;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.configapi.service.auth.ClientService;
import io.jans.configapi.service.auth.ConfigurationService;
import io.jans.configapi.service.auth.AttributeService;
@@ -103,16 +103,18 @@ public Response getOpenIdConnectClients(
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Search pattern") @DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@Parameter(description = "The 1-based index of the first query result") @DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
- @Parameter(description = "Attribute whose value will be used to order the returned response") @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
- @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder) throws EncryptionException {
+ @Parameter(description = "Attribute whose value will be used to order the returned response") @DefaultValue(ApiConstants.INUM) @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
+ @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
+ @Parameter(description = "Field and value pair for seraching", examples = @ExampleObject(name = "Field value example", value = "applicationType=web,persistClientAuthorizations=true")) @DefaultValue("") @QueryParam(value = ApiConstants.FIELD_VALUE_PAIR) String fieldValuePair) throws EncryptionException {
if (logger.isDebugEnabled()) {
- logger.debug("Client serach param - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}",
+ logger.debug("Client serach param - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}, fieldValuePair:{}",
escapeLog(limit), escapeLog(pattern), escapeLog(startIndex), escapeLog(sortBy),
- escapeLog(sortOrder));
+ escapeLog(sortOrder), escapeLog(fieldValuePair));
}
SearchRequest searchReq = createSearchRequest(clientService.getDnForClient(null), pattern, sortBy, sortOrder,
- startIndex, limit, null, null, this.getMaxCount());
+ startIndex, limit, null, null, this.getMaxCount(),fieldValuePair, Client.class);
+
return Response.ok(this.doSearch(searchReq)).build();
}
@@ -142,6 +144,7 @@ public Response getOpenIdClientByInum(@Parameter(description = "Client identifie
@RequestBody(description = "OpenID Connect Client object", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Client.class), examples = @ExampleObject(name = "Request json example", value = "example/openid-clients/clients/openid-clients-post.json")))
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Created", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Client.class), examples = @ExampleObject(name = "Response json example", value = "example/openid-clients/clients/openid-clients-get.json"))),
+ @ApiResponse(responseCode = "400", description = "Bad Request"),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@POST
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/CustomScriptResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/CustomScriptResource.java
index 28cd76f0970..6688527e4fc 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/CustomScriptResource.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/CustomScriptResource.java
@@ -17,6 +17,7 @@
import io.jans.configapi.util.ApiAccessConstants;
import io.jans.configapi.util.ApiConstants;
import io.jans.model.ScriptLocationType;
+import io.jans.model.SearchRequest;
import io.jans.model.custom.script.CustomScriptType;
import io.jans.model.custom.script.model.CustomScript;
import io.jans.orm.model.PagedResult;
@@ -57,7 +58,7 @@ public class CustomScriptResource extends ConfigBaseResource {
@Inject
CustomScriptService customScriptService;
- @Operation(summary = "Fetch custom script by name", description = "Gets a list of custom scripts", operationId = "get-config-scripts", tags = {
+ @Operation(summary = "Gets a list of custom scripts", description = "Gets a list of custom scripts", operationId = "get-config-scripts", tags = {
"Custom Scripts" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.SCRIPTS_READ_ACCESS }))
@ApiResponses(value = {
@@ -72,16 +73,20 @@ public Response getAllCustomScripts(
@Parameter(description = "Search pattern") @DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@Parameter(description = "The 1-based index of the first query result") @DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
@Parameter(description = "Attribute whose value will be used to order the returned response") @DefaultValue(ApiConstants.INUM) @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
- @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder) {
+ @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
+ @Parameter(description = "Field and value pair for seraching", examples = @ExampleObject(name = "Field value example", value = "adminCanEdit=true,dataType=string")) @DefaultValue("") @QueryParam(value = ApiConstants.FIELD_VALUE_PAIR) String fieldValuePair) {
if (logger.isDebugEnabled()) {
logger.debug(
- "Search Custom Script filters with limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}",
+ "Search Custom Script filters with limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}, fieldValuePair:{}",
escapeLog(limit), escapeLog(pattern), escapeLog(startIndex), escapeLog(sortBy),
- escapeLog(sortOrder));
+ escapeLog(sortOrder), escapeLog(fieldValuePair));
}
- return Response.ok(doSearch(pattern, sortBy, sortOrder, startIndex, limit, this.getMaxCount(), null)).build();
+ SearchRequest searchReq = createSearchRequest(customScriptService.baseDn(), pattern, sortBy,
+ sortOrder, startIndex, limit, null, null, this.getMaxCount(),fieldValuePair, CustomScript.class);
+
+ return Response.ok(doSearch(searchReq, null)).build();
}
@Operation(summary = "Fetch custom script by name", description = "Fetch custom script by name", operationId = "get-custom-script-by-name", tags = {
@@ -128,17 +133,20 @@ public Response getCustomScriptsByTypePattern(
@Parameter(description = "Search pattern") @DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@Parameter(description = "The 1-based index of the first query result") @DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
@Parameter(description = "Attribute whose value will be used to order the returned response") @DefaultValue(ApiConstants.INUM) @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
- @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder) {
+ @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
+ @Parameter(description = "Field and value pair for seraching", examples = @ExampleObject(name = "Field value example", value = "adminCanEdit=true,dataType=string")) @DefaultValue("") @QueryParam(value = ApiConstants.FIELD_VALUE_PAIR) String fieldValuePair) {
if (logger.isDebugEnabled()) {
logger.debug(
- "Custom Script to be fetched based on type - type:{}, limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}",
+ "Custom Script to be fetched based on type - type:{}, limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}, fieldValuePair:{}",
escapeLog(type), escapeLog(limit), escapeLog(pattern), escapeLog(startIndex), escapeLog(sortBy),
- escapeLog(sortOrder));
+ escapeLog(sortOrder), escapeLog(fieldValuePair));
}
- return Response.ok(doSearch(pattern, sortBy, sortOrder, startIndex, limit, this.getMaxCount(),
- CustomScriptType.getByValue(type.toLowerCase()))).build();
+ SearchRequest searchReq = createSearchRequest(customScriptService.baseDn(), pattern, sortBy,
+ sortOrder, startIndex, limit, null, null, this.getMaxCount(),fieldValuePair, CustomScript.class);
+
+ return Response.ok(doSearch(searchReq, CustomScriptType.getByValue(type.toLowerCase()))).build();
}
@Operation(summary = "Gets a script by Inum", description = "Gets a script by Inum", operationId = "get-config-scripts-by-inum", tags = {
@@ -290,15 +298,12 @@ public Response patchScript(
return Response.ok(existingScript).build();
}
- private PagedResult doSearch(String pattern, String sortBy, String sortOrder, Integer startIndex,
- int limit, int maximumRecCount, CustomScriptType type) {
+ private PagedResult doSearch(SearchRequest searchReq, CustomScriptType type) {
logger.debug(
- "CustomScript search params - - pattern:{}, sortBy:{}, sortOrder:{}, startIndex:{}, limit:{}, maximumRecCount:{}, type:{}",
- pattern, sortBy, sortOrder, startIndex, limit, maximumRecCount, type);
+ "CustomScript search request params - searchReq:{}, type:{}", searchReq, type);
- PagedResult pagedResult = customScriptService.searchScripts(pattern, sortBy, sortOrder,
- startIndex, limit, maximumRecCount, type);
+ PagedResult pagedResult = customScriptService.searchScripts(searchReq,type);
logger.debug("PagedResult - pagedResult:{}", pagedResult);
if (pagedResult != null) {
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ScopesResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ScopesResource.java
index e2eb33bbd40..26a1b0b88f7 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ScopesResource.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ScopesResource.java
@@ -9,9 +9,10 @@
import com.github.fge.jsonpatch.JsonPatch;
import com.github.fge.jsonpatch.JsonPatchException;
+import static io.jans.as.model.util.Util.escapeLog;
import io.jans.as.model.common.ScopeType;
import io.jans.as.persistence.model.Scope;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.model.PagedResult;
import io.jans.configapi.core.rest.ProtectedApi;
import io.jans.configapi.rest.model.CustomScope;
@@ -36,7 +37,6 @@
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
-import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@@ -81,17 +81,18 @@ public Response getScopes(@Parameter(description = "Scope type") @DefaultValue("
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Search pattern") @DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@Parameter(description = "The 1-based index of the first query result") @DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
- @Parameter(description = "Attribute whose value will be used to order the returned response") @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
- @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
- @Parameter(description = "Boolean fag to indicate if clients associated with the scope are to be returned") @DefaultValue("false") @QueryParam(value = ApiConstants.WITH_ASSOCIATED_CLIENTS) boolean withAssociatedClients) {
+ @Parameter(description = "Attribute whose value will be used to order the returned response") @DefaultValue(ApiConstants.INUM) @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
+ @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
+ @Parameter(description = "Boolean fag to indicate if clients associated with the scope are to be returned") @DefaultValue("false") @QueryParam(value = ApiConstants.WITH_ASSOCIATED_CLIENTS) boolean withAssociatedClients,
+ @Parameter(description = "Field and value pair for seraching", examples = @ExampleObject(name = "Field value example", value = "scopeType=spontaneous,defaultScope=true")) @DefaultValue("") @QueryParam(value = ApiConstants.FIELD_VALUE_PAIR) String fieldValuePair) {
if (log.isDebugEnabled()) {
log.debug(
- "SCOPES to be fetched based on type:{}, limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}, withAssociatedClients:{}",
- type, limit, pattern, startIndex, sortBy, sortOrder, withAssociatedClients);
+ "SCOPES to be fetched based on type:{}, limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}, withAssociatedClients:{}, fieldValuePair:{}",
+ escapeLog(type), escapeLog(limit), escapeLog(pattern), escapeLog(startIndex), escapeLog(sortBy), escapeLog(sortOrder), escapeLog(withAssociatedClients), escapeLog(fieldValuePair));
}
-
+
SearchRequest searchReq = createSearchRequest(scopeService.getDnForScope(null), pattern, sortBy, sortOrder,
- startIndex, limit, null, null, this.getMaxCount());
+ startIndex, limit, null, null, this.getMaxCount(), fieldValuePair, CustomScope.class);
return Response.ok(doSearch(searchReq, type, withAssociatedClients)).build();
}
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/UmaResourcesResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/UmaResourcesResource.java
index 12d0aee75fb..ed240450cb1 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/UmaResourcesResource.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/UmaResourcesResource.java
@@ -8,6 +8,8 @@
import com.github.fge.jsonpatch.JsonPatch;
import com.github.fge.jsonpatch.JsonPatchException;
+
+import static io.jans.as.model.util.Util.escapeLog;
import io.jans.as.model.uma.persistence.UmaResource;
import io.jans.configapi.core.rest.ProtectedApi;
import io.jans.configapi.service.auth.ClientService;
@@ -15,7 +17,7 @@
import io.jans.configapi.util.ApiAccessConstants;
import io.jans.configapi.util.ApiConstants;
import io.jans.configapi.util.AttributeNames;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.configapi.core.util.Jackson;
import io.jans.orm.exception.EntryPersistenceException;
import io.jans.orm.model.PagedResult;
@@ -37,8 +39,6 @@
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
-import static io.jans.as.model.util.Util.escapeLog;
-
import java.io.IOException;
import java.util.List;
import java.util.UUID;
@@ -74,12 +74,19 @@ public Response fetchUmaResources(
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Search pattern") @DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@Parameter(description = "The 1-based index of the first query result") @DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
- @Parameter(description = "Attribute whose value will be used to order the returned response") @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
- @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder) {
- logger.debug("UMA_RESOURCE to be fetched - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}", limit,
- pattern, startIndex, sortBy, sortOrder);
+ @Parameter(description = "Attribute whose value will be used to order the returned response") @DefaultValue(ApiConstants.INUM) @QueryParam(value = ApiConstants.SORT_BY) String sortBy,
+ @Parameter(description = "Order in which the sortBy param is applied. Allowed values are \"ascending\" and \"descending\"") @DefaultValue(ApiConstants.ASCENDING) @QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder,
+ @Parameter(description = "Field and value pair for seraching", examples = @ExampleObject(name = "Field value example", value = "deletable=true")) @DefaultValue("") @QueryParam(value = ApiConstants.FIELD_VALUE_PAIR) String fieldValuePair) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "UMA_RESOURCE to be fetched - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}, fieldValuePair:{}",
+ escapeLog(limit), escapeLog(pattern), escapeLog(startIndex), escapeLog(sortBy),
+ escapeLog(sortOrder), escapeLog(fieldValuePair));
+ }
+
+
SearchRequest searchReq = createSearchRequest(umaResourceService.getBaseDnForResource(), pattern, sortBy,
- sortOrder, startIndex, limit, null, null, this.getMaxCount());
+ sortOrder, startIndex, limit, null, null, this.getMaxCount(), fieldValuePair, UmaResource.class);
return Response.ok(doSearch(searchReq)).build();
}
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AgamaFlowService.java b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AgamaFlowService.java
index ff1ddae95fe..53f41b5499f 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AgamaFlowService.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AgamaFlowService.java
@@ -8,7 +8,7 @@
import io.jans.configapi.core.util.DataUtil;
import io.jans.configapi.model.configuration.AgamaConfiguration;
import io.jans.configapi.util.AuthUtil;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.PersistenceEntryManager;
import io.jans.orm.model.PagedResult;
import io.jans.orm.model.SortOrder;
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AttributeService.java b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AttributeService.java
index ac1b223e953..c5ce9295272 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AttributeService.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AttributeService.java
@@ -1,16 +1,19 @@
package io.jans.configapi.service.auth;
-import io.jans.model.GluuAttribute;
+import static io.jans.as.model.util.Util.escapeLog;
import io.jans.as.common.util.AttributeConstants;
import io.jans.configapi.util.ApiConstants;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.GluuAttribute;
+import io.jans.model.SearchRequest;
import io.jans.orm.model.PagedResult;
import io.jans.orm.model.SortOrder;
import io.jans.orm.search.filter.Filter;
+
import jakarta.enterprise.context.ApplicationScoped;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* @author Yuriy Zabrovarnyy
@@ -18,13 +21,17 @@
@ApplicationScoped
public class AttributeService extends io.jans.as.common.service.AttributeService {
+ private static final long serialVersionUID = -820393743995746612L;
+
@Override
protected boolean isUseLocalCache() {
return false;
}
public PagedResult searchGluuAttributes(SearchRequest searchRequest, String status) {
- log.debug("Search GluuAttributes with searchRequest:{}, status:{}", searchRequest, status);
+ if (log.isInfoEnabled()) {
+ log.info("Search GluuAttributes with searchRequest:{}, status:{}", escapeLog(searchRequest), escapeLog(status));
+ }
Filter activeFilter = null;
if (ApiConstants.ACTIVE.equalsIgnoreCase(status)) {
@@ -50,12 +57,26 @@ public PagedResult searchGluuAttributes(SearchRequest searchReque
}
searchFilter = Filter.createORFilter(filters);
}
+
+ log.trace("Attributes pattern searchFilter:{}", searchFilter);
+ List fieldValueFilters = new ArrayList<>();
+ if(searchRequest.getFieldValueMap()!=null && !searchRequest.getFieldValueMap().isEmpty())
+ {
+ for (Map.Entry entry : searchRequest.getFieldValueMap().entrySet()) {
+ Filter dataFilter = Filter.createEqualityFilter(entry.getKey(), entry.getValue());
+ log.trace("dataFilter:{}", dataFilter);
+ fieldValueFilters.add(Filter.createANDFilter(dataFilter));
+ }
+ searchFilter = Filter.createANDFilter(Filter.createORFilter(filters), Filter.createANDFilter(fieldValueFilters));
+ }
+ log.trace("Attributes pattern and field searchFilter:{}", searchFilter);
+
if (activeFilter != null) {
- searchFilter = Filter.createANDFilter(Filter.createORFilter(filters), activeFilter);
+ searchFilter = Filter.createANDFilter(searchFilter, activeFilter);
}
- log.debug("GluuAttributes to be fetched with searchFilter:{}", searchFilter);
+ log.info("GluuAttributes final searchFilter:{}", searchFilter);
return persistenceEntryManager.findPagedEntries(getDnForAttribute(null), GluuAttribute.class, searchFilter,
null, searchRequest.getSortBy(), SortOrder.getByValue(searchRequest.getSortOrder()),
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ClientService.java b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ClientService.java
index ba24587afe8..44ccd5610ea 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ClientService.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ClientService.java
@@ -19,7 +19,7 @@
import io.jans.as.model.configuration.AppConfiguration;
import io.jans.as.model.crypto.signature.SignatureAlgorithm;
import io.jans.as.model.register.ApplicationType;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.PersistenceEntryManager;
import io.jans.orm.model.PagedResult;
import io.jans.orm.model.SortOrder;
@@ -33,6 +33,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
@@ -141,6 +142,18 @@ public PagedResult getClients(SearchRequest searchRequest) {
searchFilter = Filter.createORFilter(filters);
}
+ logger.trace("Clients pattern searchFilter:{}", searchFilter);
+ List fieldValueFilters = new ArrayList<>();
+ if (searchRequest.getFieldValueMap() != null && !searchRequest.getFieldValueMap().isEmpty()) {
+ for (Map.Entry entry : searchRequest.getFieldValueMap().entrySet()) {
+ Filter dataFilter = Filter.createEqualityFilter(entry.getKey(), entry.getValue());
+ logger.trace("Clients dataFilter:{}", dataFilter);
+ fieldValueFilters.add(Filter.createANDFilter(dataFilter));
+ }
+ searchFilter = Filter.createANDFilter(Filter.createORFilter(filters),
+ Filter.createANDFilter(fieldValueFilters));
+ }
+
logger.debug("Clients searchFilter:{}", searchFilter);
return persistenceEntryManager.findPagedEntries(getDnForClient(null), Client.class, searchFilter, null,
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ScopeService.java b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ScopeService.java
index 41984f90b1f..9a16fe44f70 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ScopeService.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/ScopeService.java
@@ -15,7 +15,7 @@
import io.jans.as.model.uma.persistence.UmaResource;
import io.jans.as.persistence.model.Scope;
import io.jans.configapi.rest.model.CustomScope;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.PersistenceEntryManager;
import io.jans.orm.model.PagedResult;
import io.jans.orm.model.SortOrder;
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/UmaResourceService.java b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/UmaResourceService.java
index 3ed9ef26bb6..455c5ac0bde 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/UmaResourceService.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/UmaResourceService.java
@@ -10,7 +10,7 @@
import io.jans.as.model.config.StaticConfiguration;
import io.jans.as.model.uma.persistence.UmaResource;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.orm.PersistenceEntryManager;
import io.jans.orm.model.PagedResult;
import io.jans.orm.model.SortOrder;
diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/util/AuthUtil.java b/jans-config-api/server/src/main/java/io/jans/configapi/util/AuthUtil.java
index 5ce830de223..3f5e19168fd 100644
--- a/jans-config-api/server/src/main/java/io/jans/configapi/util/AuthUtil.java
+++ b/jans-config-api/server/src/main/java/io/jans/configapi/util/AuthUtil.java
@@ -17,6 +17,7 @@
import io.jans.configapi.security.client.AuthClientFactory;
import io.jans.configapi.configuration.ConfigurationFactory;
import io.jans.configapi.core.rest.ProtectedApi;
+import io.jans.configapi.core.service.ConfService;
import io.jans.configapi.core.util.ProtectionScopeType;
import io.jans.configapi.service.auth.ConfigurationService;
import io.jans.configapi.service.auth.ClientService;
@@ -66,6 +67,9 @@ public class AuthUtil {
@Inject
EncryptionService encryptionService;
+ @Inject
+ ConfService confService;
+
public String getOpenIdConfigurationEndpoint() {
return this.configurationService.find().getOpenIdConfigurationEndpoint();
}
@@ -73,15 +77,15 @@ public String getOpenIdConfigurationEndpoint() {
public String getAuthOpenidConfigurationUrl() {
return this.configurationFactory.getApiAppConfiguration().getAuthOpenidConfigurationUrl();
}
-
+
public AuditLogConf getAuditLogConf() {
return this.configurationFactory.getApiAppConfiguration().getAuditLogConf();
}
-
+
public DataFormatConversionConf getDataFormatConversionConf() {
return this.configurationFactory.getApiAppConfiguration().getDataFormatConversionConf();
}
-
+
public List getPluginConf() {
return this.configurationFactory.getApiAppConfiguration().getPlugins();
}
@@ -429,7 +433,7 @@ public List getAllScopeList(Map> scope
return scopeList;
}
-
+
public Date parseStringToDateObj(String dateString) {
String DATE_PATTERN_YYYY_MM_DD = "yyyy-MM-dd";
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN_YYYY_MM_DD);
@@ -438,7 +442,8 @@ public Date parseStringToDateObj(String dateString) {
try {
date = dateFormat.parse(dateString);
} catch (ParseException e) {
- log.error("Error in parsing string to date. Allowed Date Format : {}, Date-String : {} ", DATE_PATTERN_YYYY_MM_DD, dateString);
+ log.error("Error in parsing string to date. Allowed Date Format : {}, Date-String : {} ",
+ DATE_PATTERN_YYYY_MM_DD, dateString);
}
return date;
}
diff --git a/jans-config-api/server/src/main/resources/log4j2.xml b/jans-config-api/server/src/main/resources/log4j2.xml
index 38e96243e90..6de2b7088a3 100644
--- a/jans-config-api/server/src/main/resources/log4j2.xml
+++ b/jans-config-api/server/src/main/resources/log4j2.xml
@@ -69,6 +69,10 @@
+
+
+
+
diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/model/ClientAuth.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/model/ClientAuth.java
new file mode 100644
index 00000000000..17da952eae3
--- /dev/null
+++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/model/ClientAuth.java
@@ -0,0 +1,31 @@
+package io.jans.configapi.core.model;
+
+import io.jans.as.common.model.registration.Client;
+import io.jans.as.persistence.model.Scope;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import java.io.Serializable;
+import java.util.*;
+
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ClientAuth implements Serializable {
+
+ private static final long serialVersionUID = -5224720733828296181L;
+
+ private Map> clientAuths;
+
+ public Map> getClientAuths() {
+ return clientAuths;
+ }
+
+ public void setClientAuths(Map> clientAuths) {
+ this.clientAuths = clientAuths;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientAuth [clientAuths=" + clientAuths + "]";
+ }
+}
diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/rest/BaseResource.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/rest/BaseResource.java
index 4cb76109757..5fb479b20ca 100644
--- a/jans-config-api/shared/src/main/java/io/jans/configapi/core/rest/BaseResource.java
+++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/rest/BaseResource.java
@@ -11,7 +11,7 @@
import io.jans.configapi.core.interceptor.RequestAuditInterceptor;
import io.jans.configapi.core.interceptor.RequestInterceptor;
import io.jans.configapi.core.model.ApiError;
-import io.jans.configapi.core.model.SearchRequest;
+import io.jans.model.SearchRequest;
import io.jans.configapi.core.util.Util;
import io.jans.orm.model.SortOrder;
@@ -67,6 +67,7 @@ public HttpHeaders getHttpHeaders() {
public static final String MISSING_ATTRIBUTE_CODE = "OCA001";
public static final String MISSING_ATTRIBUTE_MESSAGE = "A required attribute is missing.";
public static final String TOKEN_DELIMITER = ",";
+ public static final String FIELD_VALUE_SEPARATOR = "=";
public static void checkResourceNotNull(T resource, String objectName) {
if (resource == null) {
@@ -179,26 +180,28 @@ protected static Response getInternalServerException(String msg) {
}
protected SearchRequest createSearchRequest(String schemas, String filter, String sortBy, String sortOrder,
- Integer startIndex, Integer count, String attrsList, String excludedAttrsList, int maximumRecCount) {
+ Integer startIndex, Integer count, String attrsList, String excludedAttrsList, int maximumRecCount, String fieldValuePair, Class> entityClass) {
if (log.isDebugEnabled()) {
log.debug(
- "Search Request params:: - schemas:{}, filter:{}, sortBy:{}, sortOrder:{}, startIndex:{}, count:{}, attrsList:{}, excludedAttrsList:{}, maximumRecCount:{}",
+ "Search Request params:: - schemas:{}, filter:{}, sortBy:{}, sortOrder:{}, startIndex:{}, count:{}, attrsList:{}, excludedAttrsList:{}, maximumRecCount:{}, fieldValuePair:{}, entityClass:{}",
escapeLog(schemas), escapeLog(filter), escapeLog(sortBy), escapeLog(sortOrder),
escapeLog(startIndex), escapeLog(count), escapeLog(attrsList), escapeLog(excludedAttrsList),
- escapeLog(maximumRecCount));
+ escapeLog(maximumRecCount), escapeLog(fieldValuePair), escapeLog(entityClass));
}
+
SearchRequest searchRequest = new SearchRequest();
+ searchRequest.setEntityClass(entityClass);
// Validation
checkNotEmpty(schemas, "Schema");
int maxCount = maximumRecCount;
- log.debug(" count:{}, maxCount:{}", count, maxCount);
+ log.trace(" count:{}, maxCount:{}", count, maxCount);
if (count > maxCount) {
throwBadRequestException("Maximum number of results per page is " + maxCount);
}
count = count == null ? maxCount : count;
- log.debug(" count:{} ", count);
+ log.trace(" count:{} ", count);
// Per spec, a negative value SHALL be interpreted as "0" for count
if (count < 0) {
count = 0;
@@ -207,7 +210,7 @@ protected SearchRequest createSearchRequest(String schemas, String filter, Strin
if (StringUtils.isEmpty(sortOrder) || !sortOrder.equals(SortOrder.DESCENDING.getValue())) {
sortOrder = SortOrder.ASCENDING.getValue();
}
- log.debug(" util.getTokens(filter,TOKEN_DELIMITER):{} ", util.getTokens(filter, TOKEN_DELIMITER));
+ log.debug(" util.getTokens(filter,TOKEN_DELIMITER):{} , util.getFieldValueMap(searchRequest, fieldValuePair, TOKEN_DELIMITER, FIELD_VALUE_SEPARATOR)):{}", util.getTokens(filter, TOKEN_DELIMITER), util.getFieldValueMap(entityClass, fieldValuePair, TOKEN_DELIMITER, FIELD_VALUE_SEPARATOR));
searchRequest.setSchemas(schemas);
searchRequest.setAttributes(attrsList);
searchRequest.setExcludedAttributes(excludedAttrsList);
@@ -218,6 +221,7 @@ protected SearchRequest createSearchRequest(String schemas, String filter, Strin
searchRequest.setCount(count);
searchRequest.setMaxCount(maximumRecCount);
searchRequest.setFilterAssertionValue(util.getTokens(filter, TOKEN_DELIMITER));
+ searchRequest.setFieldValueMap((util.getFieldValueMap(entityClass, fieldValuePair, TOKEN_DELIMITER, FIELD_VALUE_SEPARATOR)));
return searchRequest;
}
diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/service/ConfService.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/service/ConfService.java
index d606c633631..58a7201d0cc 100644
--- a/jans-config-api/shared/src/main/java/io/jans/configapi/core/service/ConfService.java
+++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/service/ConfService.java
@@ -10,36 +10,59 @@
import io.jans.as.model.config.Conf;
import io.jans.as.model.configuration.AppConfiguration;
import io.jans.orm.PersistenceEntryManager;
-
+import io.jans.orm.reflect.property.PropertyAnnotation;
+import io.jans.orm.reflect.util.ReflectHelper;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Map;
+
import org.slf4j.Logger;
@ApplicationScoped
public class ConfService {
-
+
private static String dn = "ou=jans-auth,ou=configuration,o=jans";
-
+
@Inject
private Logger logger;
-
+
@Inject
private PersistenceEntryManager persistenceEntryManager;
-
@Inject
ConfigurationService configurationService;
public Conf findConf() {
- logger.debug("\n\n ConfService::findConf() - Entry \n\n");
return persistenceEntryManager.find(dn, Conf.class, null);
}
-
public AppConfiguration find() {
final Conf conf = findConf();
return conf.getDynamic();
}
+ public List getEntryPropertyAnnotations(Class entryClass) {
+ return persistenceEntryManager.getEntryPropertyAnnotations(entryClass);
+ }
+
+ public Map> getPropertiesAnnotations(Class> theClass, Class>... allowedAnnotations) {
+
+ logger.info("Getting Properties Annotations for theClass:{}, allowedAnnotations:{}", theClass,
+ allowedAnnotations);
+ Map> propertiesAnnotations = null;
+ if (theClass == null || allowedAnnotations == null || allowedAnnotations.length == 0) {
+ return propertiesAnnotations;
+ }
+
+ propertiesAnnotations = ReflectHelper.getPropertiesAnnotations(theClass, allowedAnnotations);
+
+ logger.info("Properties Annotations for theClass:{}, allowedAnnotations:{} are propertiesAnnotations:{}",
+ theClass, allowedAnnotations, propertiesAnnotations);
+
+ return propertiesAnnotations;
+ }
+
}
diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/util/Util.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/util/Util.java
index 3bc94cf4c9c..1af44b0c39d 100644
--- a/jans-config-api/shared/src/main/java/io/jans/configapi/core/util/Util.java
+++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/util/Util.java
@@ -6,9 +6,17 @@
package io.jans.configapi.core.util;
+import io.jans.configapi.core.service.ConfService;
+import io.jans.model.SearchRequest;
+import io.jans.orm.annotation.AttributeName;
+import io.jans.orm.annotation.AttributesList;
+
+import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.stream.Collectors;
import jakarta.enterprise.context.ApplicationScoped;
@@ -20,17 +28,24 @@
@ApplicationScoped
public class Util {
+ private static final Class>[] LDAP_ENTRY_PROPERTY_ANNOTATIONS = { AttributeName.class, AttributesList.class };
+
@Inject
Logger log;
+ @Inject
+ ConfService confService;
+
public static String escapeLog(Object param) {
if (param == null)
return "";
return param.toString().replaceAll("[\n\r\t]", "_");
}
- public List getTokens(String str, String format) {
- log.debug(" String to get tokens - str:{}, format:{}", str, format);
+ public List getTokens(String str, String tokenizer) {
+ if (log.isInfoEnabled()) {
+ log.info(" String to get tokens - str:{}, tokenizer:{}", escapeLog(str), escapeLog(tokenizer));
+ }
ArrayList list = new ArrayList<>();
if (StringUtils.isBlank(str)) {
@@ -38,17 +53,115 @@ public List getTokens(String str, String format) {
return list;
}
- log.debug("str.contains(format):{}", str.contains(format));
- if (!str.contains(format)) {
+ log.trace("str.contains(tokenizer):{}", str.contains(tokenizer));
+ if (!str.contains(tokenizer)) {
list.add(str);
- log.debug(" Not tokenized - list:{}", list);
+ log.trace(" Not tokenized string - list:{}", list);
return list;
}
- log.debug("final tokenized list:{}", Collections.list(new StringTokenizer(str, format)).stream()
+ log.info("final tokenized list:{}", Collections.list(new StringTokenizer(str, tokenizer)).stream()
.map(token -> (String) token).collect(Collectors.toList()));
- return Collections.list(new StringTokenizer(str, format)).stream().map(token -> (String) token)
+
+ return Collections.list(new StringTokenizer(str, tokenizer)).stream().map(token -> (String) token)
.collect(Collectors.toList());
}
+
+ public Map getFieldValueMap(Class> entityClass, String str, String tokenizer,
+ String fieldValueSeparator) {
+ if (log.isInfoEnabled()) {
+ log.info(" Field Value to get map - entityClass:{}, str:{}, tokenizer:{} fieldValueSeparator:{}",
+ escapeLog(entityClass), escapeLog(str), escapeLog(tokenizer), escapeLog(fieldValueSeparator));
+ }
+
+ Map fieldValueMap = new HashMap<>();
+
+ if (StringUtils.isBlank(str) || !str.contains(fieldValueSeparator)) {
+ return fieldValueMap;
+ }
+
+ log.trace("getTokens(str, tokenizer):{}", getTokens(str, tokenizer));
+
+ List fieldValueList = getTokens(str, tokenizer);
+ log.debug("fieldValueList:{}", fieldValueList);
+
+ if (fieldValueList == null || fieldValueList.isEmpty()) {
+ return fieldValueMap;
+ }
+
+ for (String data : fieldValueList) {
+ StringTokenizer st = new StringTokenizer(str, fieldValueSeparator);
+
+ if (StringUtils.isNotBlank(data) && st.hasMoreTokens()) {
+ String[] keyValue = data.split("=");
+ log.debug("fieldValueMap:{},keyValue:{}, keyValue[0]:{}, keyValue[1]):{}", fieldValueMap, keyValue,
+ keyValue[0], keyValue[1]);
+ fieldValueMap.put(keyValue[0], keyValue[1]);
+ }
+ }
+
+ log.info("fieldValueMap:{}", fieldValueMap);
+
+ // Replace filedValue with the DB field name
+ fieldValueMap = getAttributeData(entityClass, fieldValueMap);
+ return fieldValueMap;
+ }
+
+ public Map getAttributeData(Class> entityClass, Map fieldValueMap) {
+ if (log.isInfoEnabled()) {
+ log.info("AttributeData details to be fetched for entityClass:{} with fieldValueMap:{} ",
+ escapeLog(entityClass), escapeLog(fieldValueMap));
+ }
+
+ if (entityClass == null || fieldValueMap == null || fieldValueMap.isEmpty()) {
+ return fieldValueMap;
+ }
+
+ Map> propertiesAnnotations = confService.getPropertiesAnnotations(entityClass,
+ LDAP_ENTRY_PROPERTY_ANNOTATIONS);
+ log.debug("Properties annotations fetched for theClass:{} are propertiesAnnotations:{}", entityClass,
+ propertiesAnnotations);
+
+ if (propertiesAnnotations == null || propertiesAnnotations.isEmpty()) {
+ return fieldValueMap;
+ }
+
+ Map updatedFieldValueMap = new HashMap<>();
+ if (fieldValueMap != null && !fieldValueMap.isEmpty()) {
+
+ for (Map.Entry entry : fieldValueMap.entrySet()) {
+ log.debug("entry.getKey():{}, entry.getValue():{}", entry.getKey(), entry.getValue());
+ String dbFieldName = getFieldDBName(entry.getKey(), propertiesAnnotations.get(entry.getKey()));
+ if (StringUtils.isNotBlank(dbFieldName)) {
+ updatedFieldValueMap.put(dbFieldName, entry.getValue());
+ } else {
+ updatedFieldValueMap.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ log.info("Returning updatedFieldValueMap:{} ", updatedFieldValueMap);
+ return updatedFieldValueMap;
+ }
+
+ private String getFieldDBName(String fieldName, List annotations) {
+ log.info("DB field to be fetched for fieldName:{} are annotations:{}", fieldName, annotations);
+ if (StringUtils.isBlank(fieldName) || (annotations == null || annotations.isEmpty())) {
+ return fieldName;
+ }
+
+ for (Annotation annotation : annotations) {
+ try {
+ AttributeName attributeName = (AttributeName) annotation;
+ if (attributeName != null && StringUtils.isNotBlank(attributeName.name())) {
+ fieldName = attributeName.name();
+ }
+ } catch (Exception ex) {
+ log.error("Error while fetching DB fieldName for fieldName:{} is :{}", fieldName, ex);
+ }
+ }
+
+ log.info("Final DB field fieldName:{} ", fieldName);
+ return fieldName;
+ }
}
diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/model/SearchRequest.java b/jans-core/service/src/main/java/io/jans/model/SearchRequest.java
similarity index 76%
rename from jans-config-api/shared/src/main/java/io/jans/configapi/core/model/SearchRequest.java
rename to jans-core/service/src/main/java/io/jans/model/SearchRequest.java
index cbbb9363ca4..39643fcb804 100644
--- a/jans-config-api/shared/src/main/java/io/jans/configapi/core/model/SearchRequest.java
+++ b/jans-core/service/src/main/java/io/jans/model/SearchRequest.java
@@ -1,15 +1,17 @@
-package io.jans.configapi.core.model;
+package io.jans.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
@JsonIgnoreProperties(ignoreUnknown = true)
public class SearchRequest {
+ private Class> entityClass;
private String schemas;
private List attributes;
private List excludedAttributes;
@@ -21,6 +23,7 @@ public class SearchRequest {
private int maxCount;
private List filterAttributeName;
private List filterAssertionValue;
+ private Map fieldValueMap;
@JsonIgnore
private String attributesStr;
@@ -28,6 +31,14 @@ public class SearchRequest {
@JsonIgnore
private String excludedAttributesStr;
+ public Class> getEntityClass() {
+ return entityClass;
+ }
+
+ public void setEntityClass(Class> entityClass) {
+ this.entityClass = entityClass;
+ }
+
public String getSchemas() {
return schemas;
}
@@ -140,12 +151,22 @@ public void setFilterAssertionValue(List filterAssertionValue) {
this.filterAssertionValue = filterAssertionValue;
}
+ public Map getFieldValueMap() {
+ return fieldValueMap;
+ }
+
+ public void setFieldValueMap(Map fieldValueMap) {
+ this.fieldValueMap = fieldValueMap;
+ }
+
@Override
public String toString() {
- return "SearchRequest [schemas=" + schemas + ", attributes=" + attributes + ", excludedAttributes="
- + excludedAttributes + ", filter=" + filter + ", sortBy=" + sortBy + ", sortOrder=" + sortOrder
- + ", startIndex=" + startIndex + ", count=" + count + ", maxCount=" + maxCount
- + ", filterAttributeName=" + filterAttributeName + ", filterAssertionValue=" + filterAssertionValue
- + ", attributesStr=" + attributesStr + ", excludedAttributesStr=" + excludedAttributesStr + "]";
+ return "SearchRequest [entityClass=" + entityClass + ", schemas=" + schemas + ", attributes=" + attributes
+ + ", excludedAttributes=" + excludedAttributes + ", filter=" + filter + ", sortBy=" + sortBy
+ + ", sortOrder=" + sortOrder + ", startIndex=" + startIndex + ", count=" + count + ", maxCount="
+ + maxCount + ", filterAttributeName=" + filterAttributeName + ", filterAssertionValue="
+ + filterAssertionValue + ", fieldValueMap=" + fieldValueMap + ", attributesStr=" + attributesStr
+ + ", excludedAttributesStr=" + excludedAttributesStr + "]";
}
+
}
diff --git a/jans-core/service/src/main/java/io/jans/service/custom/CustomScriptService.java b/jans-core/service/src/main/java/io/jans/service/custom/CustomScriptService.java
index 5cd45bace87..1d66e0c1f46 100644
--- a/jans-core/service/src/main/java/io/jans/service/custom/CustomScriptService.java
+++ b/jans-core/service/src/main/java/io/jans/service/custom/CustomScriptService.java
@@ -9,6 +9,11 @@
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import io.jans.model.SearchRequest;
import io.jans.model.custom.script.CustomScriptType;
import io.jans.model.custom.script.model.CustomScript;
import io.jans.orm.model.PagedResult;
@@ -18,6 +23,7 @@
import io.jans.service.custom.script.AbstractCustomScriptService;
import io.jans.util.OxConstants;
+
/**
* Operations with custom scripts
*
@@ -38,7 +44,7 @@ public String baseDn() {
public PagedResult searchScripts(String pattern, String sortBy, String sortOrder, Integer startIndex,
int limit, int maximumRecCount, CustomScriptType type) {
log.debug(
- "Search CustomScript with searchRequest - pattern:{}, sortBy:{}, sortOrder:{}, startIndex:{}, limit:{}, maximumRecCount:{}, type:{}",
+ "Search CustomScript with param - pattern:{}, sortBy:{}, sortOrder:{}, startIndex:{}, limit:{}, maximumRecCount:{}, type:{}",
pattern, sortBy, sortOrder, startIndex, limit, maximumRecCount, type);
Filter searchFilter = null;
@@ -67,7 +73,63 @@ public PagedResult searchScripts(String pattern, String sortBy, St
log.debug("Searching CustomScript Flow with filter:{}", filter);
return persistenceEntryManager.findPagedEntries(baseDn(), CustomScript.class, filter, null, sortBy,
- SortOrder.getByValue(sortOrder), startIndex , limit, maximumRecCount);
+ SortOrder.getByValue(sortOrder), startIndex, limit, maximumRecCount);
}
+
+ public PagedResult searchScripts(SearchRequest searchRequest, CustomScriptType type) {
+ log.info("Search CustomScript with searchRequest - searchRequest:{}, type:{}", searchRequest, type);
+
+ Filter searchFilter = null;
+ List filters = new ArrayList<>();
+
+ if (searchRequest.getFilterAssertionValue() != null && !searchRequest.getFilterAssertionValue().isEmpty()) {
+
+ for (String assertionValue : searchRequest.getFilterAssertionValue()) {
+ String[] targetArray = new String[] { assertionValue };
+ boolean useLowercaseFilter = isLowercaseFilter(baseDn());
+ if (useLowercaseFilter) {
+ filters.add(Filter.createORFilter(
+ Filter.createSubstringFilter(Filter.createLowercaseFilter(OxConstants.DESCRIPTION), null,
+ targetArray, null),
+ Filter.createSubstringFilter(Filter.createLowercaseFilter(OxConstants.DISPLAY_NAME), null,
+ targetArray, null)));
+ } else {
+ filters.add(Filter.createORFilter(
+ Filter.createSubstringFilter(OxConstants.DESCRIPTION, null, targetArray, null),
+ Filter.createSubstringFilter(OxConstants.DISPLAY_NAME, null, targetArray, null)));
+ }
+
+ }
+ searchFilter = Filter.createORFilter(filters);
+ }
+
+ log.trace("CustomScript pattern searchFilter:{}", searchFilter);
+ List fieldValueFilters = new ArrayList<>();
+ if (searchRequest.getFieldValueMap() != null && !searchRequest.getFieldValueMap().isEmpty()) {
+ for (Map.Entry entry : searchRequest.getFieldValueMap().entrySet()) {
+ Filter dataFilter = Filter.createEqualityFilter(entry.getKey(), entry.getValue());
+ log.trace("CustomScript dataFilter:{}", dataFilter);
+ fieldValueFilters.add(Filter.createANDFilter(dataFilter));
+ }
+ searchFilter = Filter.createANDFilter(Filter.createORFilter(filters),
+ Filter.createANDFilter(fieldValueFilters));
+ }
+
+ log.trace("CustomScript pattern and field searchFilter:{}", searchFilter);
+
+ Filter filter = searchFilter;
+ log.debug("filter:{}", filter);
+ if (type != null) {
+ Filter typeFilter = Filter.createEqualityFilter(OxConstants.SCRIPT_TYPE, type);
+ filter = Filter.createANDFilter(searchFilter, typeFilter);
+ }
+
+ log.info("Searching CustomScript Flow with filter:{}", filter);
+ return persistenceEntryManager.findPagedEntries(baseDn(), CustomScript.class, filter, null,
+ searchRequest.getSortBy(), SortOrder.getByValue(searchRequest.getSortOrder()),
+ searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getMaxCount());
+
+ }
+
}