Skip to content

Commit 8bb8b70

Browse files
authored
feat(jans-config-api): pagination functionality for attribute endoint (#2232)
* feat(config-api): added pagination related param to request * feat(jans-config-api): pagination enhancement * feat(jans-config-api): pagination enhancement * feat(jans-config-api): pagination enhancement * feat(jans-config-api): pagination changes * feat(jans-config-api): pagination changes * feat(jans-config-api): pagination code * feat(jans-config-api): pagination code * feat(jans-config-api): pagination code * feat(jans-config-api): pagination code * feat(jans-config-api): pagination code
1 parent fb0b6d7 commit 8bb8b70

File tree

11 files changed

+175
-90
lines changed

11 files changed

+175
-90
lines changed

jans-config-api/common/src/main/java/io/jans/configapi/util/ApiConstants.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ private ApiConstants() {}
108108
public static final String ACTIVE = "active";
109109
public static final String INACTIVE = "inactive";
110110

111-
112-
113111
// API Protection
114112
public static final String PROTECTION_TYPE_OAUTH2 = "oauth2";
115113
public static final String PROTECTION_TYPE_UMA = "uma";
@@ -127,5 +125,12 @@ private ApiConstants() {}
127125
public static final int DEFAULT_MAX_COUNT = 200;
128126
public static final String SORT_BY = "sortBy";
129127
public static final String SORT_ORDER = "sortOrder";
128+
public static final String ASCENDING = "ascending";
129+
public static final String DESCENDING = "descending";
130+
public static final String TOTAL_ITEMS = "totalItems";
131+
public static final String ENTRIES_COUNT = "entriesCount";
132+
public static final String DATA = "data";
133+
134+
130135

131136
}

jans-config-api/docs/jans-config-api-swagger.yaml

+73-39
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,12 @@ paths:
195195
$ref: '#/components/responses/InternalServerError'
196196
security:
197197
- oauth2: [ https://jans.io/oauth/config/fido2.readonly ]
198+
198199
/jans-config-api/api/v1/attributes:
199200
get:
200201
summary: Gets a list of Gluu attributes.
201202
description: 'Gets all attributes. Optionally max-size of the result, attribute status and pattern can be provided.'
202-
operationId: get-attributes
203+
operationId: get-all-attribute
203204
tags:
204205
- Attribute
205206
responses:
@@ -208,11 +209,21 @@ paths:
208209
content:
209210
application/json:
210211
schema:
211-
title: Gluu Attributes
212-
description: List of all attribute.
213-
type: array
214-
items:
215-
$ref: '#/components/schemas/GluuAttribute'
212+
title: Gluu Attributes paginated result
213+
description: Gluu Attributes paginated result
214+
type: object
215+
properties:
216+
totalItems:
217+
type: integer
218+
description: Total number of records in the database.
219+
entriesCount:
220+
type: integer
221+
description: Total number of records in the response.
222+
data:
223+
description: List of all attribute.
224+
type: array
225+
items:
226+
$ref: '#/components/schemas/GluuAttribute'
216227
'401':
217228
description: Unauthorized
218229
'500':
@@ -237,6 +248,30 @@ paths:
237248
in: query
238249
name: status
239250
description: Status of the attribute
251+
- schema:
252+
type: integer
253+
default: 1
254+
in: query
255+
name: startIndex
256+
description: The 1-based index of the first query result.
257+
- schema:
258+
type: string
259+
default: inum
260+
in: query
261+
name: sortBy
262+
description: Attribute whose value will be used to order the returned response.
263+
- schema:
264+
type: string
265+
default: ascending
266+
enum:
267+
- ascending
268+
- descending
269+
in: query
270+
name: sortOrder
271+
description: Order in which the sortBy param is applied. Allowed values are "ascending" and "descending".
272+
273+
274+
240275
post:
241276
summary: Adds a new attribute.
242277
description: Adds a new attribute.
@@ -1018,7 +1053,7 @@ paths:
10181053
$ref: '#/components/responses/InternalServerError'
10191054
security:
10201055
- oauth2: [https://jans.io/oauth/config/scripts.write]
1021-
1056+
10221057
/jans-config-api/api/v1/config/scripts/name/{name}:
10231058
parameters:
10241059
- name: name
@@ -2054,7 +2089,7 @@ paths:
20542089
description: Internal Server Error
20552090
security:
20562091
- oauth2: [https://jans.io/oauth/config/openid/clients.write]
2057-
2092+
20582093
/jans-config-api/api/v1/uma/resources:
20592094
get:
20602095
tags:
@@ -2171,7 +2206,7 @@ paths:
21712206
description: Internal Server Error
21722207
security:
21732208
- oauth2: [https://jans.io/oauth/config/uma/resources.readonly]
2174-
2209+
21752210
delete:
21762211
tags:
21772212
- OAuth - UMA Resources
@@ -2189,7 +2224,7 @@ paths:
21892224
description: Internal Server Error
21902225
security:
21912226
- oauth2: [https://jans.io/oauth/config/uma/resources.delete]
2192-
2227+
21932228
patch:
21942229
tags:
21952230
- OAuth - UMA Resources
@@ -2221,8 +2256,8 @@ paths:
22212256
description: Internal Server Error
22222257
security:
22232258
- oauth2: [https://jans.io/oauth/config/uma/resources.write]
2224-
2225-
2259+
2260+
22262261
/jans-config-api/api/v1/uma/resources/clientId/{clientId}:
22272262
parameters:
22282263
- name: clientId
@@ -2443,7 +2478,7 @@ paths:
24432478
description: Internal Server Error
24442479
security:
24452480
- oauth2: [https://jans.io/oauth/config/scopes.write]
2446-
2481+
24472482
/jans-config-api/api/v1/scopes/creator/{creatorId}:
24482483
parameters:
24492484
- schema:
@@ -2476,7 +2511,7 @@ paths:
24762511
description: Internal Server Error
24772512
security:
24782513
- oauth2: ['https://jans.io/oauth/config/scopes.readonly']
2479-
2514+
24802515
/jans-config-api/api/v1/scopes/type/{type}:
24812516
parameters:
24822517
- schema:
@@ -2561,7 +2596,7 @@ paths:
25612596
$ref: '#/components/responses/InternalServerError'
25622597
security:
25632598
- oauth2: [https://jans.io/oauth/config/agama.write]
2564-
2599+
25652600
/jans-config-api/api/v1/agama/{qname}:
25662601
parameters:
25672602
- schema:
@@ -2590,7 +2625,7 @@ paths:
25902625
$ref: '#/components/responses/InternalServerError'
25912626
security:
25922627
- oauth2: [https://jans.io/oauth/config/agama.readonly]
2593-
2628+
25942629
post:
25952630
summary: Create a new agama flow from source.
25962631
description: Create a new agama flow from source.
@@ -2647,7 +2682,7 @@ paths:
26472682
$ref: '#/components/responses/InternalServerError'
26482683
security:
26492684
- oauth2: [https://jans.io/oauth/config/agama.write]
2650-
2685+
26512686
delete:
26522687
summary: Deletes an agama flow based on Qname.
26532688
description: Deletes an agama flow based on Qname.
@@ -2665,7 +2700,7 @@ paths:
26652700
description: Internal Server Error
26662701
security:
26672702
- oauth2: [https://jans.io/oauth/config/agama.delete]
2668-
2703+
26692704
/jans-config-api/api/v1/agama/source/{qname}:
26702705
parameters:
26712706
- schema:
@@ -2674,7 +2709,7 @@ paths:
26742709
in: path
26752710
description: flow qname.
26762711
required: true
2677-
2712+
26782713
put:
26792714
summary: Update agama flow from source file.
26802715
description: Update agama flow from source file.
@@ -2700,7 +2735,7 @@ paths:
27002735
$ref: '#/components/responses/InternalServerError'
27012736
security:
27022737
- oauth2: [https://jans.io/oauth/config/agama.write]
2703-
2738+
27042739
/jans-config-api/api/v1/stat:
27052740
get:
27062741
summary: Provides server with basic statistic.
@@ -2818,7 +2853,7 @@ paths:
28182853
$ref: '#/components/schemas/StatsData'
28192854
'500':
28202855
description: Internal Server Error
2821-
2856+
28222857
/jans-config-api/api/v1/jans-auth-server/session:
28232858
get:
28242859
summary: Returns current session.
@@ -2843,7 +2878,7 @@ paths:
28432878
$ref: '#/components/responses/Unauthorized'
28442879
'500':
28452880
description: Internal Server Error
2846-
2881+
28472882
/jans-config-api/api/v1/jans-auth-server/session/{userDn}:
28482883
parameters:
28492884
- name: userDn
@@ -4269,7 +4304,7 @@ components:
42694304
example: 'https://server.example.com/jans-auth/restv1/par'
42704305
requirePar:
42714306
description: boolean value to indicate of Pushed Authorisation Request(PAR)is required.
4272-
type: boolean
4307+
type: boolean
42734308
deviceAuthzEndpoint:
42744309
type: string
42754310
description: URL for the Device Authorization.
@@ -4301,11 +4336,11 @@ components:
43014336
mtlsEndSessionEndpoint:
43024337
type: string
43034338
description: URL for MTLS to which an RP can perform a redirect to request that the end user be logged out at the OP.
4304-
example: 'https://server.example.com/jans-auth/restv1/mtls/end_session'
4339+
example: 'https://server.example.com/jans-auth/restv1/mtls/end_session'
43054340
mtlsJwksUri:
43064341
type: string
43074342
description: URL for MTLS of the OP\'s JSON Web Key Set (JWK) document.
4308-
example: 'https://server.example.com/jans-auth/restv1/mtls/jwks'
4343+
example: 'https://server.example.com/jans-auth/restv1/mtls/jwks'
43094344
mtlsRegistrationEndpoint:
43104345
type: string
43114346
description: URL for MTLS Registration endpoint.
@@ -4325,7 +4360,7 @@ components:
43254360
mtlsDeviceAuthzEndpoint:
43264361
type: string
43274362
description: URL for MTLS Device Authorization endpoint.
4328-
example: 'https://server.example.com/jans-auth/restv1/mtls/device_authorization'
4363+
example: 'https://server.example.com/jans-auth/restv1/mtls/device_authorization'
43294364
sessionAsJwt:
43304365
type: boolean
43314366
description: Boolean value true saves session data as a JWT.
@@ -4398,7 +4433,7 @@ components:
43984433
type: string
43994434
enum:
44004435
- mail
4401-
- uid
4436+
- uid
44024437
responseTypesSupported:
44034438
type: array
44044439
description: A list of the OAuth 2.0 response_type values that this OP supports.
@@ -4443,7 +4478,7 @@ components:
44434478
description: Default Subject Type used for Dynamic Client Registration.
44444479
enum:
44454480
- public
4446-
- pairwise
4481+
- pairwise
44474482
authorizationSigningAlgValuesSupported:
44484483
type: array
44494484
description: A list of the authorization signing algorithms supported.
@@ -4470,9 +4505,9 @@ components:
44704505
type: string
44714506
enum:
44724507
- RSA1_5
4473-
- RSA-OAEP
4474-
- A128KW
4475-
- A256KW
4508+
- RSA-OAEP
4509+
- A128KW
4510+
- A256KW
44764511
authorizationEncryptionEncValuesSupported:
44774512
type: array
44784513
description: A list of the authorization encryption algorithms supported.
@@ -5576,9 +5611,9 @@ components:
55765611
description: Expiry date of the Scope.
55775612
type: string
55785613
format: date
5579-
5614+
55805615

5581-
5616+
55825617
ExtendedScope:
55835618
allOf: # Combines the Scope and the inline model
55845619
- $ref: '#/components/schemas/Scope'
@@ -5590,7 +5625,7 @@ components:
55905625
type: array
55915626
items:
55925627
$ref: '#/components/schemas/Client'
5593-
5628+
55945629
CustomAttribute:
55955630
title: CustomAttribute
55965631
description: Attribute.
@@ -5711,8 +5746,8 @@ components:
57115746
jansDefaultPromptLogin:
57125747
description: sets prompt=login to the authorization request, which causes the authorization server to force the user to sign in again before it will show the authorization prompt.
57135748
type: boolean
5714-
5715-
5749+
5750+
57165751
Client:
57175752
title: Client object
57185753
description: Client.
@@ -7688,7 +7723,7 @@ components:
76887723
codeError:
76897724
type: string
76907725
description: Errors in the flow source detected by Agama transpiler
7691-
7726+
76927727
SessionId:
76937728
title: Session details
76947729
description: Session details
@@ -7736,7 +7771,7 @@ components:
77367771
description: Map containing permission.
77377772
type: object
77387773
additionalProperties:
7739-
type: boolean
7774+
type: boolean
77407775
sessionAttributes:
77417776
description: Session attributes
77427777
type: object
@@ -7753,4 +7788,3 @@ components:
77537788
description: Session creation date.
77547789
type: string
77557790
format: date
7756-

jans-config-api/profiles/default/config-api-test.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The URL of your Jans installation
22
test.server=https://jenkins-config-api.gluu.org
33

4-
test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/database/couchbase.readonly https://jans.io/oauth/config/database/couchbase.write https://jans.io/oauth/config/database/couchbase.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete
4+
test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/database/couchbase.readonly https://jans.io/oauth/config/database/couchbase.write https://jans.io/oauth/config/database/couchbase.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session
55

66
token.endpoint=https://jenkins-config-api.gluu.org/jans-auth/restv1/token
77
token.grant.type=client_credentials

jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/AgamaResource.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class AgamaResource extends ConfigBaseResource {
5353
@GET
5454
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS })
5555
public Response getFlows(@DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
56-
@DefaultValue(DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
56+
@DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
5757
@DefaultValue("false") @QueryParam(value = ApiConstants.INCLUDE_SOURCE) boolean includeSource) {
5858

5959
if (logger.isDebugEnabled()) {

0 commit comments

Comments
 (0)