Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"feat(jans-config-api): pagination functionality for attribute endoint #2232

Merged
merged 13 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ private ApiConstants() {}
public static final String ACTIVE = "active";
public static final String INACTIVE = "inactive";



// API Protection
public static final String PROTECTION_TYPE_OAUTH2 = "oauth2";
public static final String PROTECTION_TYPE_UMA = "uma";
Expand All @@ -127,5 +125,12 @@ private ApiConstants() {}
public static final int DEFAULT_MAX_COUNT = 200;
public static final String SORT_BY = "sortBy";
public static final String SORT_ORDER = "sortOrder";
public static final String ASCENDING = "ascending";
public static final String DESCENDING = "descending";
public static final String TOTAL_ITEMS = "totalItems";
public static final String ENTRIES_COUNT = "entriesCount";
public static final String DATA = "data";



}
112 changes: 73 additions & 39 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ paths:
$ref: '#/components/responses/InternalServerError'
security:
- oauth2: [ https://jans.io/oauth/config/fido2.readonly ]

/jans-config-api/api/v1/attributes:
get:
summary: Gets a list of Gluu attributes.
description: 'Gets all attributes. Optionally max-size of the result, attribute status and pattern can be provided.'
operationId: get-attributes
operationId: get-all-attribute
tags:
- Attribute
responses:
Expand All @@ -208,11 +209,21 @@ paths:
content:
application/json:
schema:
title: Gluu Attributes
description: List of all attribute.
type: array
items:
$ref: '#/components/schemas/GluuAttribute'
title: Gluu Attributes paginated result
description: Gluu Attributes paginated result
type: object
properties:
totalItems:
type: integer
description: Total number of records in the database.
entriesCount:
type: integer
description: Total number of records in the response.
data:
description: List of all attribute.
type: array
items:
$ref: '#/components/schemas/GluuAttribute'
'401':
description: Unauthorized
'500':
Expand All @@ -237,6 +248,30 @@ paths:
in: query
name: status
description: Status of the attribute
- schema:
type: integer
default: 1
in: query
name: startIndex
description: The 1-based index of the first query result.
- schema:
type: string
default: inum
in: query
name: sortBy
description: Attribute whose value will be used to order the returned response.
- schema:
type: string
default: ascending
enum:
- ascending
- descending
in: query
name: sortOrder
description: Order in which the sortBy param is applied. Allowed values are "ascending" and "descending".



post:
summary: Adds a new attribute.
description: Adds a new attribute.
Expand Down Expand Up @@ -1018,7 +1053,7 @@ paths:
$ref: '#/components/responses/InternalServerError'
security:
- oauth2: [https://jans.io/oauth/config/scripts.write]

/jans-config-api/api/v1/config/scripts/name/{name}:
parameters:
- name: name
Expand Down Expand Up @@ -2054,7 +2089,7 @@ paths:
description: Internal Server Error
security:
- oauth2: [https://jans.io/oauth/config/openid/clients.write]

/jans-config-api/api/v1/uma/resources:
get:
tags:
Expand Down Expand Up @@ -2171,7 +2206,7 @@ paths:
description: Internal Server Error
security:
- oauth2: [https://jans.io/oauth/config/uma/resources.readonly]

delete:
tags:
- OAuth - UMA Resources
Expand All @@ -2189,7 +2224,7 @@ paths:
description: Internal Server Error
security:
- oauth2: [https://jans.io/oauth/config/uma/resources.delete]

patch:
tags:
- OAuth - UMA Resources
Expand Down Expand Up @@ -2221,8 +2256,8 @@ paths:
description: Internal Server Error
security:
- oauth2: [https://jans.io/oauth/config/uma/resources.write]


/jans-config-api/api/v1/uma/resources/clientId/{clientId}:
parameters:
- name: clientId
Expand Down Expand Up @@ -2443,7 +2478,7 @@ paths:
description: Internal Server Error
security:
- oauth2: [https://jans.io/oauth/config/scopes.write]

/jans-config-api/api/v1/scopes/creator/{creatorId}:
parameters:
- schema:
Expand Down Expand Up @@ -2476,7 +2511,7 @@ paths:
description: Internal Server Error
security:
- oauth2: ['https://jans.io/oauth/config/scopes.readonly']

/jans-config-api/api/v1/scopes/type/{type}:
parameters:
- schema:
Expand Down Expand Up @@ -2561,7 +2596,7 @@ paths:
$ref: '#/components/responses/InternalServerError'
security:
- oauth2: [https://jans.io/oauth/config/agama.write]

/jans-config-api/api/v1/agama/{qname}:
parameters:
- schema:
Expand Down Expand Up @@ -2590,7 +2625,7 @@ paths:
$ref: '#/components/responses/InternalServerError'
security:
- oauth2: [https://jans.io/oauth/config/agama.readonly]

post:
summary: Create a new agama flow from source.
description: Create a new agama flow from source.
Expand Down Expand Up @@ -2647,7 +2682,7 @@ paths:
$ref: '#/components/responses/InternalServerError'
security:
- oauth2: [https://jans.io/oauth/config/agama.write]

delete:
summary: Deletes an agama flow based on Qname.
description: Deletes an agama flow based on Qname.
Expand All @@ -2665,7 +2700,7 @@ paths:
description: Internal Server Error
security:
- oauth2: [https://jans.io/oauth/config/agama.delete]

/jans-config-api/api/v1/agama/source/{qname}:
parameters:
- schema:
Expand All @@ -2674,7 +2709,7 @@ paths:
in: path
description: flow qname.
required: true

put:
summary: Update agama flow from source file.
description: Update agama flow from source file.
Expand All @@ -2700,7 +2735,7 @@ paths:
$ref: '#/components/responses/InternalServerError'
security:
- oauth2: [https://jans.io/oauth/config/agama.write]

/jans-config-api/api/v1/stat:
get:
summary: Provides server with basic statistic.
Expand Down Expand Up @@ -2818,7 +2853,7 @@ paths:
$ref: '#/components/schemas/StatsData'
'500':
description: Internal Server Error

/jans-config-api/api/v1/jans-auth-server/session:
get:
summary: Returns current session.
Expand All @@ -2843,7 +2878,7 @@ paths:
$ref: '#/components/responses/Unauthorized'
'500':
description: Internal Server Error

/jans-config-api/api/v1/jans-auth-server/session/{userDn}:
parameters:
- name: userDn
Expand Down Expand Up @@ -4269,7 +4304,7 @@ components:
example: 'https://server.example.com/jans-auth/restv1/par'
requirePar:
description: boolean value to indicate of Pushed Authorisation Request(PAR)is required.
type: boolean
type: boolean
deviceAuthzEndpoint:
type: string
description: URL for the Device Authorization.
Expand Down Expand Up @@ -4301,11 +4336,11 @@ components:
mtlsEndSessionEndpoint:
type: string
description: URL for MTLS to which an RP can perform a redirect to request that the end user be logged out at the OP.
example: 'https://server.example.com/jans-auth/restv1/mtls/end_session'
example: 'https://server.example.com/jans-auth/restv1/mtls/end_session'
mtlsJwksUri:
type: string
description: URL for MTLS of the OP\'s JSON Web Key Set (JWK) document.
example: 'https://server.example.com/jans-auth/restv1/mtls/jwks'
example: 'https://server.example.com/jans-auth/restv1/mtls/jwks'
mtlsRegistrationEndpoint:
type: string
description: URL for MTLS Registration endpoint.
Expand All @@ -4325,7 +4360,7 @@ components:
mtlsDeviceAuthzEndpoint:
type: string
description: URL for MTLS Device Authorization endpoint.
example: 'https://server.example.com/jans-auth/restv1/mtls/device_authorization'
example: 'https://server.example.com/jans-auth/restv1/mtls/device_authorization'
sessionAsJwt:
type: boolean
description: Boolean value true saves session data as a JWT.
Expand Down Expand Up @@ -4398,7 +4433,7 @@ components:
type: string
enum:
- mail
- uid
- uid
responseTypesSupported:
type: array
description: A list of the OAuth 2.0 response_type values that this OP supports.
Expand Down Expand Up @@ -4443,7 +4478,7 @@ components:
description: Default Subject Type used for Dynamic Client Registration.
enum:
- public
- pairwise
- pairwise
authorizationSigningAlgValuesSupported:
type: array
description: A list of the authorization signing algorithms supported.
Expand All @@ -4470,9 +4505,9 @@ components:
type: string
enum:
- RSA1_5
- RSA-OAEP
- A128KW
- A256KW
- RSA-OAEP
- A128KW
- A256KW
authorizationEncryptionEncValuesSupported:
type: array
description: A list of the authorization encryption algorithms supported.
Expand Down Expand Up @@ -5576,9 +5611,9 @@ components:
description: Expiry date of the Scope.
type: string
format: date



ExtendedScope:
allOf: # Combines the Scope and the inline model
- $ref: '#/components/schemas/Scope'
Expand All @@ -5590,7 +5625,7 @@ components:
type: array
items:
$ref: '#/components/schemas/Client'

CustomAttribute:
title: CustomAttribute
description: Attribute.
Expand Down Expand Up @@ -5711,8 +5746,8 @@ components:
jansDefaultPromptLogin:
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.
type: boolean


Client:
title: Client object
description: Client.
Expand Down Expand Up @@ -7688,7 +7723,7 @@ components:
codeError:
type: string
description: Errors in the flow source detected by Agama transpiler

SessionId:
title: Session details
description: Session details
Expand Down Expand Up @@ -7736,7 +7771,7 @@ components:
description: Map containing permission.
type: object
additionalProperties:
type: boolean
type: boolean
sessionAttributes:
description: Session attributes
type: object
Expand All @@ -7753,4 +7788,3 @@ components:
description: Session creation date.
type: string
format: date

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

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
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

token.endpoint=https://jenkins-config-api.gluu.org/jans-auth/restv1/token
token.grant.type=client_credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class AgamaResource extends ConfigBaseResource {
@GET
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS })
public Response getFlows(@DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@DefaultValue(DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@DefaultValue("false") @QueryParam(value = ApiConstants.INCLUDE_SOURCE) boolean includeSource) {

if (logger.isDebugEnabled()) {
Expand Down
Loading