From faf2888f3d58d14fc6361d5a9ff5f743984cea4f Mon Sep 17 00:00:00 2001 From: pujavs <43700552+pujavs@users.noreply.github.com> Date: Tue, 13 Dec 2022 16:22:10 +0530 Subject: [PATCH] feat(config-api): health check response rectification and Agama ADS swagger spec (#3293) * feat(config-api): health check response rectification and Agama ADS swagger spec * feat(config-api): health check response rectification and Agama ADS swagger spec * feat(config-api): search changed to 0-index based rather than 1-index based --- .../io/jans/configapi/util/ApiConstants.java | 2 +- .../docs/jans-config-api-swagger-auto.yaml | 316 +++++++++++++++--- .../plugins/docs/user-mgt-plugin-swagger.yaml | 2 +- .../plugin/mgt/service/UserMgmtService.java | 2 +- .../jans/configapi/rest/ApiApplication.java | 17 +- .../configapi/rest/health/ApiHealthCheck.java | 2 +- .../resource/auth/ADSDeploymentsResource.java | 47 +++ .../rest/resource/auth/AgamaResource.java | 14 +- .../service/auth/AgamaFlowService.java | 6 +- .../service/auth/AttributeService.java | 2 +- .../configapi/service/auth/ClientService.java | 2 +- .../configapi/service/auth/ScopeService.java | 2 +- .../service/auth/UmaResourceService.java | 2 +- .../service/custom/CustomScriptService.java | 2 +- 14 files changed, 345 insertions(+), 73 deletions(-) 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 de26f4bef3a..b7cd128755e 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 @@ -122,7 +122,7 @@ private ApiConstants() {} //Pagination public static final String DEFAULT_LIST_SIZE = "50"; - public static final String DEFAULT_LIST_START_INDEX = "1"; + public static final String DEFAULT_LIST_START_INDEX = "0"; public static final int DEFAULT_MAX_COUNT = 200; public static final String SORT_BY = "sortBy"; public static final String SORT_ORDER = "sortOrder"; diff --git a/jans-config-api/docs/jans-config-api-swagger-auto.yaml b/jans-config-api/docs/jans-config-api-swagger-auto.yaml index 9825ae9b5c1..8cd1a1fa157 100644 --- a/jans-config-api/docs/jans-config-api-swagger-auto.yaml +++ b/jans-config-api/docs/jans-config-api-swagger-auto.yaml @@ -30,7 +30,8 @@ tags: - name: OAuth - OpenID Connect - Clients - name: OAuth - UMA Resources - name: OAuth - Scopes -- name: Configuration – Agama Flow +- name: Agama - Configuration +- name: Agama - Developer Studio - name: Statistics - User - name: Health - Check - name: Server Stats @@ -104,6 +105,154 @@ paths: $ref: '#/components/schemas/StatsData' "500": description: InternalServerError + /api/v1/ads-deployment: + get: + tags: + - Agama - Developer Studio + summary: Fetches deployed Agama project based on name. + description: Fetches deployed Agama project based on name. + operationId: get-agama-dev-studio-prj-by-name + parameters: + - name: name + in: query + schema: + type: string + responses: + "200": + description: Agama project + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + examples: + Response json example: + description: Response json example + value: "" + "204": + description: No Content + "400": + description: Bad Request + "401": + description: Unauthorized + "404": + description: Not Found + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/agama.readonly + - https://jans.io/oauth/config/agama.write + - https://jans.io/oauth/config/read-all + post: + tags: + - Agama - Developer Studio + summary: Deploy an Agama project. + description: Deploy an Agama project. + operationId: post-agama-dev-studio-prj + parameters: + - name: name + in: query + schema: + type: string + requestBody: + content: + application/zip: + schema: + type: array + items: + type: string + format: byte + responses: + "202": + description: Agama project accepted + content: + application/zip: + schema: + type: string + examples: + Response json example: + description: Response json example + value: "" + "400": + description: Bad Request + "401": + description: Unauthorized + "409": + description: Conflict + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/agama.readonly + - https://jans.io/oauth/config/agama.write + - https://jans.io/oauth/config/read-all + delete: + tags: + - Agama - Developer Studio + summary: Delete a deployed Agama project. + description: Delete a deployed Agama project. + operationId: delete-agama-dev-studio-prj + parameters: + - name: name + in: query + schema: + type: string + responses: + "204": + description: No Content + "400": + description: Bad Request + "401": + description: Unauthorized + "404": + description: Not Found + "409": + description: Conflict + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/agama.readonly + - https://jans.io/oauth/config/agama.write + - https://jans.io/oauth/config/read-all + /api/v1/ads-deployment/list: + get: + tags: + - Agama - Developer Studio + summary: Retrieve the list of projects deployed currently. + description: Retrieve the list of projects deployed currently. + operationId: get-agama-dev-prj + parameters: + - name: start + in: query + schema: + type: integer + format: int32 + - name: count + in: query + schema: + type: integer + format: int32 + responses: + "200": + description: Agama projects + content: + application/json: + schema: + $ref: '#/components/schemas/PagedResult' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/agama.readonly + - https://jans.io/oauth/config/agama.write + - https://jans.io/oauth/config/read-all /api/v1/acrs: get: tags: @@ -173,7 +322,7 @@ paths: /api/v1/agama: get: tags: - - Configuration – Agama Flow + - Agama - Configuration summary: Fetches all agama flow. description: Fetches all agama flow. operationId: get-agama-flows @@ -194,7 +343,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: @@ -250,7 +399,7 @@ paths: - https://jans.io/oauth/config/read-all post: tags: - - Configuration – Agama Flow + - Agama - Configuration summary: Create a new agama flow description: Create a new agama flow operationId: post-agama-flow @@ -295,7 +444,7 @@ paths: /api/v1/agama/{qname}: get: tags: - - Configuration – Agama Flow + - Agama - Configuration summary: Gets an agama flow based on Qname. description: Gets an agama flow based on Qname. operationId: get-agama-flow @@ -342,7 +491,7 @@ paths: - https://jans.io/oauth/config/read-all post: tags: - - Configuration – Agama Flow + - Agama - Configuration summary: Create a new agama flow from source description: Create a new agama flow from source. operationId: post-agama-flow-from-source @@ -391,7 +540,7 @@ paths: - https://jans.io/oauth/config/agama.write delete: tags: - - Configuration – Agama Flow + - Agama - Configuration summary: Deletes an agama flow based on Qname description: Deletes an agama flow based on Qname operationId: delete-agama-flow @@ -415,7 +564,7 @@ paths: - https://jans.io/oauth/config/agama.delete patch: tags: - - Configuration – Agama Flow + - Agama - Configuration summary: Partially modify a Agama Flow description: Partially modify a Agama Flow operationId: patch-agama-flow @@ -466,7 +615,7 @@ paths: /api/v1/agama/source/{qname}: put: tags: - - Configuration – Agama Flow + - Agama - Configuration summary: Update agama flow from source file description: Update agama flow from source file. operationId: put-agama-flow-from-source @@ -542,7 +691,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: @@ -1623,7 +1772,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: @@ -3416,7 +3565,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: @@ -3854,7 +4003,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: @@ -4869,7 +5018,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: @@ -6453,7 +6602,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: @@ -6896,6 +7045,58 @@ components: format: date-time facterData: $ref: '#/components/schemas/FacterData' + Deployment: + type: object + properties: + dn: + type: string + id: + type: string + createdAt: + type: string + format: date-time + taskActive: + type: boolean + finishedAt: + type: string + format: date-time + assets: + type: string + details: + $ref: '#/components/schemas/DeploymentDetails' + baseDn: + type: string + DeploymentDetails: + type: object + properties: + projectName: + type: string + folders: + type: array + items: + type: string + flowsError: + type: object + additionalProperties: + type: string + error: + type: string + PagedResult: + type: object + properties: + start: + type: integer + format: int32 + totalEntriesCount: + type: integer + format: int32 + entriesCount: + type: integer + format: int32 + entries: + type: array + items: + type: object AuthenticationMethod: type: object properties: @@ -6950,22 +7151,6 @@ components: type: object additionalProperties: type: object - PagedResult: - type: object - properties: - start: - type: integer - format: int32 - totalEntriesCount: - type: integer - format: int32 - entriesCount: - type: integer - format: int32 - entries: - type: array - items: - type: object JsonPatch: type: object AttributeValidation: @@ -7085,16 +7270,16 @@ components: type: boolean userCanView: type: boolean - userCanEdit: - type: boolean userCanAccess: type: boolean - adminCanAccess: + userCanEdit: type: boolean - adminCanView: + adminCanAccess: type: boolean adminCanEdit: type: boolean + adminCanView: + type: boolean baseDn: type: string PatchRequest: @@ -7856,9 +8041,9 @@ components: format: int32 defaultSignatureAlgorithm: type: string - oxOpenIdConnectVersion: + jansOpenIdConnectVersion: type: string - oxId: + jansId: type: string dynamicRegistrationExpirationTime: type: integer @@ -8021,15 +8206,15 @@ components: type: string staticDecryptionKid: type: string - oxElevenTestModeToken: + jansElevenTestModeToken: type: string - oxElevenGenerateKeyEndpoint: + jansElevenGenerateKeyEndpoint: type: string - oxElevenSignEndpoint: + jansElevenSignEndpoint: type: string - oxElevenVerifySignatureEndpoint: + jansElevenVerifySignatureEndpoint: type: string - oxElevenDeleteKeyEndpoint: + jansElevenDeleteKeyEndpoint: type: string introspectionAccessTokenMustHaveUmaProtectionScope: type: boolean @@ -8244,8 +8429,14 @@ components: type: string agamaConfiguration: $ref: '#/components/schemas/EngineConfig' + dcrSsaValidationConfigs: + type: array + items: + $ref: '#/components/schemas/SsaValidationConfig' ssaConfiguration: $ref: '#/components/schemas/SsaConfiguration' + blockWebviewAuthorizationEnabled: + type: boolean enabledFeatureFlags: uniqueItems: true type: array @@ -8437,6 +8628,43 @@ components: ssaExpirationInDays: type: integer format: int32 + SsaValidationConfig: + type: object + properties: + id: + type: string + type: + type: string + enum: + - NONE + - SSA + - DCR + displayName: + type: string + description: + type: string + scopes: + type: array + items: + type: string + allowedClaims: + type: array + items: + type: string + jwks: + type: string + jwksUri: + type: string + issuers: + type: array + items: + type: string + configurationEndpoint: + type: string + configurationEndpointClaim: + type: string + sharedSecret: + type: string PersistenceConfiguration: type: object properties: @@ -8540,13 +8768,13 @@ components: type: boolean internal: type: boolean + locationPath: + type: string locationType: type: string enum: - ldap - file - locationPath: - type: string baseDn: type: string ScriptError: 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 871aacaec5b..49cefa8ac12 100644 --- a/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml +++ b/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml @@ -40,7 +40,7 @@ paths: schema: type: integer format: int32 - default: 1 + default: 0 - name: sortBy in: query schema: 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 4ae0f2d205e..31636504810 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 @@ -90,7 +90,7 @@ public PagedResult searchUsers(SearchRequest searchRequest) { return persistenceEntryManager.findPagedEntries(getPeopleBaseDn(), User.class, searchFilter, null, searchRequest.getSortBy(), SortOrder.getByValue(searchRequest.getSortOrder()), - searchRequest.getStartIndex() - 1, searchRequest.getCount(), searchRequest.getMaxCount()); + searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getMaxCount()); } diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/ApiApplication.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/ApiApplication.java index 9367088be0e..0e223a8a5ad 100644 --- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/ApiApplication.java +++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/ApiApplication.java @@ -32,18 +32,17 @@ license = @License(name = "Apache 2.0", url = "https://github.com/JanssenProject/jans/blob/main/LICENSE")), - tags = { @Tag(name = "Attribute"), @Tag(name = "Default Authentication Method"),@Tag(name = "Cache Configuration"), - @Tag(name = "Cache Configuration – Memcached"), @Tag(name = "Cache Configuration – Redis"), - @Tag(name = "Cache Configuration – in-Memory"), @Tag(name = "Cache Configuration – Native-Persistence"), - @Tag(name = "Configuration – Properties"), + tags = { @Tag(name = "Attribute"), @Tag(name = "Default Authentication Method"), + @Tag(name = "Cache Configuration"), @Tag(name = "Cache Configuration – Memcached"), + @Tag(name = "Cache Configuration – Redis"), @Tag(name = "Cache Configuration – in-Memory"), + @Tag(name = "Cache Configuration – Native-Persistence"), @Tag(name = "Configuration – Properties"), @Tag(name = "Configuration – SMTP"), @Tag(name = "Configuration – Logging"), @Tag(name = "Configuration – JWK - JSON Web Key (JWK)"), @Tag(name = "Custom Scripts"), - @Tag(name = "Database - LDAP configuration"), - @Tag(name = "OAuth - OpenID Connect - Clients"), @Tag(name = "OAuth - UMA Resources"), - @Tag(name = "OAuth - Scopes"), @Tag(name = "Configuration – Agama Flow"), + @Tag(name = "Database - LDAP configuration"), @Tag(name = "OAuth - OpenID Connect - Clients"), + @Tag(name = "OAuth - UMA Resources"), @Tag(name = "OAuth - Scopes"), + @Tag(name = "Agama - Configuration"), @Tag(name = "Agama - Developer Studio"), @Tag(name = "Statistics - User"), @Tag(name = "Health - Check"), @Tag(name = "Server Stats"), - @Tag(name = "Auth - Session Management"), - @Tag(name = "Organization Configuration"), + @Tag(name = "Auth - Session Management"), @Tag(name = "Organization Configuration"), @Tag(name = "Auth Server Health - Check") }, servers = { @Server(url = "https://jans.io/", description = "The Jans server") }) diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/health/ApiHealthCheck.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/health/ApiHealthCheck.java index d3cce225d1d..2da948d2d91 100644 --- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/health/ApiHealthCheck.java +++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/health/ApiHealthCheck.java @@ -93,7 +93,7 @@ public Response getLivenessResponse() { liveness.setStatus("UP"); logger.debug("ApiHealthCheck::getLivenessResponse() - liveness:{}",liveness); - return Response.ok(liveness.toString()).build(); + return Response.ok(liveness).build(); } @Operation(summary = "Returns application readiness status", description = "Returns application readiness status", operationId = "get-config-health-ready", tags = { diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ADSDeploymentsResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ADSDeploymentsResource.java index 77af1151f90..fc0a540e57a 100644 --- a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ADSDeploymentsResource.java +++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/ADSDeploymentsResource.java @@ -2,6 +2,13 @@ import io.jans.ads.model.Deployment; import io.jans.orm.model.PagedResult; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.jans.configapi.core.rest.ProtectedApi; import io.jans.configapi.util.ApiAccessConstants; import io.jans.configapi.util.ApiConstants; @@ -19,6 +26,14 @@ public class ADSDeploymentsResource extends ConfigBaseResource { @Inject private ADSDeploymentsService ads; + @Operation(summary = "Retrieve the list of projects deployed currently.", description = "Retrieve the list of projects deployed currently.", operationId = "get-agama-dev-prj", tags = { + "Agama - Developer Studio" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS, + ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Agama projects", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = PagedResult.class), examples = @ExampleObject(name = "Response json example", value = "example/agama/agama-dev-prj-get-all.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) @GET @Path("list") @ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS }, groupScopes = { @@ -35,6 +50,17 @@ public Response getDeployments(@QueryParam("start") int start, @QueryParam("coun } + @Operation(summary = "Fetches deployed Agama project based on name.", description = "Fetches deployed Agama project based on name.", operationId = "get-agama-dev-studio-prj-by-name", tags = { + "Agama - Developer Studio" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS, + ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Agama project", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Deployment.class), examples = @ExampleObject(name = "Response json example", value = "example/agama/agama-dev-prj-get.json"))), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "404", description = "Not Found"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) @GET @ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS }, groupScopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }) @@ -60,6 +86,16 @@ public Response getDeployment(@QueryParam("name") String projectName) { } + @Operation(summary = "Deploy an Agama project.", description = "Deploy an Agama project.", operationId = "post-agama-dev-studio-prj", tags = { + "Agama - Developer Studio" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS, + ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })) + @ApiResponses(value = { + @ApiResponse(responseCode = "202", description = "Agama project accepted", content = @Content(mediaType = "application/zip", schema = @Schema(implementation = String.class), examples = @ExampleObject(name = "Response json example", value = "example/agama/agama-dev-prj-post.json"))), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "409", description = "Conflict"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) @POST @Consumes("application/zip") @ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS }, @@ -80,6 +116,17 @@ public Response deploy(@QueryParam("name") String projectName, byte[] gamaBinary } + @Operation(summary = "Delete a deployed Agama project.", description = "Delete a deployed Agama project.", operationId = "delete-agama-dev-studio-prj", tags = { + "Agama - Developer Studio" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS, + ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })) + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "404", description = "Not Found"), + @ApiResponse(responseCode = "409", description = "Conflict"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) @DELETE @ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS }) 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 7e339b63f8d..6b6efc42fb4 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 @@ -60,7 +60,7 @@ public class AgamaResource extends ConfigBaseResource { AgamaFlowService agamaFlowService; @Operation(summary = "Fetches all agama flow.", description = "Fetches all agama flow.", operationId = "get-agama-flows", tags = { - "Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = { + "Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS, ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })) @ApiResponses(value = { @@ -91,7 +91,7 @@ public Response getFlows(@DefaultValue("") @QueryParam(value = ApiConstants.PATT } @Operation(summary = "Gets an agama flow based on Qname.", description = "Gets an agama flow based on Qname.", operationId = "get-agama-flow", tags = { - "Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = { + "Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS, ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })) @ApiResponses(value = { @@ -117,7 +117,7 @@ public Response getFlowByName(@PathParam(ApiConstants.QNAME) @NotNull String flo } @Operation(summary = "Create a new agama flow", description = "Create a new agama flow", operationId = "post-agama-flow", tags = { - "Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = { + "Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })) @RequestBody(description = "Agama Flow", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Flow.class), examples = @ExampleObject(name = "Request example", value = "example/agama/agama.json"))) @ApiResponses(value = { @@ -149,7 +149,7 @@ public Response createFlow(@Valid Flow flow) } @Operation(summary = "Create a new agama flow from source", description = "Create a new agama flow from source.", operationId = "post-agama-flow-from-source", tags = { - "Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = { + "Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })) @RequestBody(description = "Agama Flow", content = @Content(mediaType = MediaType.TEXT_PLAIN, schema = @Schema(implementation = String.class), examples = @ExampleObject(name = "Request example", value = "example/agama/test-agama-source.json"))) @ApiResponses(value = { @@ -191,7 +191,7 @@ public Response createFlowFromSource(@PathParam(ApiConstants.QNAME) @NotNull Str } @Operation(summary = "Update agama flow from source file", description = "Update agama flow from source file.", operationId = "put-agama-flow-from-source", tags = { - "Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = { + "Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })) @RequestBody(description = "String representing patch-document.", content = @Content(mediaType = MediaType.TEXT_PLAIN, schema = @Schema(implementation = String.class), examples = @ExampleObject(name = "Request example", value = "example/agama/test-agama-source.json"))) @ApiResponses(value = { @@ -228,7 +228,7 @@ public Response updateFlowSource(@PathParam(ApiConstants.QNAME) @NotNull String } @Operation(summary = "Partially modify a Agama Flow", description = "Partially modify a Agama Flow", operationId = "patch-agama-flow", tags = { - "Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = { + "Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })) @RequestBody(description = "JsonPatch object", content = @Content(mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, array = @ArraySchema(schema = @Schema(implementation = JsonPatch.class)), examples = @ExampleObject(name = "Request example", value = "example/agama/agama-patch.json"))) @ApiResponses(value = { @@ -267,7 +267,7 @@ public Response patchFlow(@PathParam(ApiConstants.QNAME) @NotNull String flowNam } @Operation(summary = "Deletes an agama flow based on Qname", description = "Deletes an agama flow based on Qname", operationId = "delete-agama-flow", tags = { - "Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = { + "Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { ApiAccessConstants.AGAMA_DELETE_ACCESS })) @ApiResponses(value = { @ApiResponse(responseCode = "204", description = "No Content"), @ApiResponse(responseCode = "401", description = "Unauthorized"), 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 504c1ec6bb0..2334dda1cbe 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 @@ -84,16 +84,14 @@ public PagedResult searchFlows(SearchRequest searchRequest) { Filter searchFilter = null; if (StringUtils.isNotBlank(searchRequest.getFilter())) { String[] targetArray = new String[] { searchRequest.getFilter() }; - searchFilter = Filter.createORFilter( - Filter.createSubstringFilter(Flow.ATTR_NAMES.QNAME, null, targetArray, null), - Filter.createSubstringFilter(Flow.ATTR_NAMES.META, null, targetArray, null)); + searchFilter = Filter.createSubstringFilter(Flow.ATTR_NAMES.QNAME, null, targetArray, null); } logger.debug("Searching Agama Flow with searchFilter:{}", searchFilter); return persistenceEntryManager.findPagedEntries(getAgamaFlowDn(null), Flow.class, searchFilter, null, searchRequest.getSortBy(), SortOrder.getByValue(searchRequest.getSortOrder()), - searchRequest.getStartIndex() - 1, searchRequest.getCount(), searchRequest.getMaxCount()); + searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getMaxCount()); } 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 e3c8c18d810..56e0bdff28e 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 @@ -59,7 +59,7 @@ public PagedResult searchGluuAttributes(SearchRequest searchReque return persistenceEntryManager.findPagedEntries(getDnForAttribute(null), GluuAttribute.class, searchFilter, null, searchRequest.getSortBy(), SortOrder.getByValue(searchRequest.getSortOrder()), - searchRequest.getStartIndex() - 1, searchRequest.getCount(), searchRequest.getMaxCount()); + searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getMaxCount()); } 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 bba5890f4fc..365e667a8c2 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 @@ -142,7 +142,7 @@ public PagedResult getClients(SearchRequest searchRequest) { return persistenceEntryManager.findPagedEntries(getDnForClient(null), Client.class, searchFilter, null, searchRequest.getSortBy(), SortOrder.getByValue(searchRequest.getSortOrder()), - searchRequest.getStartIndex() - 1, searchRequest.getCount(), searchRequest.getMaxCount()); + searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getMaxCount()); } 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 720a098ecba..a15f3fc5641 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 @@ -338,7 +338,7 @@ public PagedResult getScopeResult(SearchRequest searchRequest, Stri PagedResult pagedResult = persistenceEntryManager.findPagedEntries(getDnForScope(null), CustomScope.class, searchFilter, null, searchRequest.getSortBy(), - SortOrder.getByValue(searchRequest.getSortOrder()), searchRequest.getStartIndex() - 1, + SortOrder.getByValue(searchRequest.getSortOrder()), searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getMaxCount()); if (pagedResult != null) { 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 3e931b1a85a..3ed9ef26bb6 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 @@ -162,7 +162,7 @@ public PagedResult searchUmaResource(SearchRequest searchRequest) { return persistenceEntryManager.findPagedEntries(getBaseDnForResource(), UmaResource.class, searchFilter, null, searchRequest.getSortBy(), SortOrder.getByValue(searchRequest.getSortOrder()), - searchRequest.getStartIndex() - 1, searchRequest.getCount(), searchRequest.getMaxCount()); + searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getMaxCount()); } } 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 b33b2a66d9f..5cd45bace87 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 @@ -67,7 +67,7 @@ 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 - 1, limit, maximumRecCount); + SortOrder.getByValue(sortOrder), startIndex , limit, maximumRecCount); } }