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

fix(config-ap): lock audit endpoint parameter declaration error#9460 #9473

Merged
merged 75 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
a3f3a66
fix(config-api): asset mgt endpoint fixes
pujavs Aug 5, 2024
9e309c0
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 5, 2024
59fd269
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
5a6396a
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
521f7b1
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
73618dd
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 6, 2024
583c881
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 7, 2024
95c57e4
fix(config-api): asset upload
pujavs Aug 8, 2024
ca50ec7
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 8, 2024
bbcbc92
fix(config-api): lock review comments
pujavs Aug 8, 2024
2bb92e3
feat(config-api): lock code review comments
pujavs Aug 9, 2024
c900d5f
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
eb62da4
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 9, 2024
6fad621
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
d17d2e6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 9, 2024
7fefadb
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
cf85c47
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
c0444b5
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 11, 2024
ccf9ace
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
2d4a379
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
dd6555c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
4696f98
feat(config-api): fido2 delete functionality
pujavs Aug 13, 2024
3b51e0d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 13, 2024
5af8a00
fix(config-api): acr validation
pujavs Aug 14, 2024
88e3a20
feat(config-api): doc(config-api): IDP schema attribute descriptions …
pujavs Aug 15, 2024
cadc584
feat(config-api): sync with main
pujavs Aug 15, 2024
c4eb118
feat(config-api): sync with main
pujavs Aug 15, 2024
4de3cc0
feat(config-api): uploading assets via API generates 2 entries #9178
pujavs Aug 15, 2024
dfbc4f1
feat(config-api): asset mgt, fido and IDP changes
pujavs Aug 16, 2024
c3ba202
feat(config-api): fido2 device endpoint
pujavs Aug 19, 2024
34d1c9a
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 20, 2024
4473a90
feat(config-api): fido2 endpoint
pujavs Aug 20, 2024
6d974ed
feat(config-api): fido2 endpoint
pujavs Aug 20, 2024
5272c28
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 21, 2024
c6f2234
feat(config-api): sync with main
pujavs Aug 21, 2024
cbc8164
feat(config-api): sync with main
pujavs Aug 21, 2024
8e45ae3
feat(config-api): sync with main
pujavs Aug 21, 2024
d2c8277
feat(config-api): resolved sonar review issues
pujavs Aug 21, 2024
792c81c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 22, 2024
9dfba84
feat(config-api): sonar review comment fix
pujavs Aug 22, 2024
54b2f59
feat(config-api): swagger spec
pujavs Aug 22, 2024
8d92097
feat(config-api): swagger spec
pujavs Aug 22, 2024
e078be2
feat(config-api): saml config attribute description
pujavs Aug 22, 2024
b7eac33
doc(config-api): added SAML attribute description
pujavs Aug 23, 2024
1fd93d8
doc(config-api): added SAML attribute description
pujavs Aug 23, 2024
28fed18
feat(config-api): sync with main
pujavs Aug 26, 2024
0d05fb6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 27, 2024
573e47e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 30, 2024
4590a55
feat(config-api): sync with main
pujavs Aug 30, 2024
cd764d6
fix(jans-lock): code review comment fix isssue#9305
pujavs Aug 30, 2024
d4e4c41
fix(jans-lock): code review comment fix isssue#9305
pujavs Aug 30, 2024
07ca449
feat(config-api): lock review point
pujavs Sep 2, 2024
2e98591
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 3, 2024
a513d11
fix(lock): code review comment
pujavs Sep 3, 2024
7e86521
fix(lock): code review comment
pujavs Sep 3, 2024
db7f37d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 4, 2024
f1c1c29
fix(config-api): sync with main
pujavs Sep 4, 2024
77c5d46
feat(config-api): lock endpoint fixes and SAML IDP NPE
pujavs Sep 5, 2024
e00453b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 5, 2024
89e16ee
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 6, 2024
39a8321
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 6, 2024
43323bf
feat(config-api): asset enhancement
pujavs Sep 9, 2024
7de3f99
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 9, 2024
e982673
feat(config-api): implement timer for asset mgt to fetch and deploy a…
pujavs Sep 9, 2024
fb95955
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 9, 2024
ec1eb27
fix(config-api): scope validation issue #9426
pujavs Sep 9, 2024
847b024
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 10, 2024
eac818b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 10, 2024
ea2479f
fix(config-api): asset delete error fix
pujavs Sep 10, 2024
9a5b999
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 10, 2024
4b0b0b8
feat(config-api): sysnc with main
pujavs Sep 11, 2024
c8121e9
feat(config-api): sysnc with main
pujavs Sep 11, 2024
41104fc
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 12, 2024
17d91eb
fix(config-ap): lock audit endpoint parameter declaration error#9460
pujavs Sep 12, 2024
8058ab9
Merge branch 'main' into jans-config-fix
yuriyz Sep 12, 2024
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
16 changes: 8 additions & 8 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8370,20 +8370,20 @@ components:
type: string
selected:
type: boolean
adminCanEdit:
whitePagesCanView:
type: boolean
userCanView:
type: boolean
userCanEdit:
type: boolean
adminCanView:
type: boolean
userCanView:
adminCanEdit:
type: boolean
adminCanAccess:
type: boolean
userCanAccess:
type: boolean
whitePagesCanView:
type: boolean
baseDn:
type: string
PatchRequest:
Expand Down Expand Up @@ -10371,14 +10371,14 @@ components:
type: boolean
internal:
type: boolean
locationPath:
type: string
locationType:
type: string
enum:
- ldap
- db
- file
locationPath:
type: string
baseDn:
type: string
ScriptError:
Expand Down Expand Up @@ -10807,10 +10807,10 @@ components:
ttl:
type: integer
format: int32
opbrowserState:
type: string
persisted:
type: boolean
opbrowserState:
type: string
SessionIdAccessMap:
type: object
properties:
Expand Down
12 changes: 6 additions & 6 deletions jans-config-api/plugins/docs/lock-plugin-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ paths:
format: int32
default: 50
- name: eventStartDate
in: path
in: query
description: Event start date in ISO8601 format
required: true
schema:
type: string
- name: eventEndtDate
in: path
in: query
description: Event end date in ISO8601 format
required: true
schema:
Expand Down Expand Up @@ -77,13 +77,13 @@ paths:
format: int32
default: 50
- name: eventStartDate
in: path
in: query
description: Event start date in ISO8601 format
required: true
schema:
type: string
- name: eventEndtDate
in: path
in: query
description: Event end date in ISO8601 format
required: true
schema:
Expand Down Expand Up @@ -122,13 +122,13 @@ paths:
format: int32
default: 50
- name: eventStartDate
in: path
in: query
description: Event start date in ISO8601 format
required: true
schema:
type: string
- name: eventEndtDate
in: path
in: query
description: Event end date in ISO8601 format
required: true
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

package io.jans.configapi.plugin.lock.rest;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;

import io.jans.as.common.service.common.ApplicationFactory;
import io.jans.configapi.core.model.ApiError;
import io.jans.configapi.core.rest.BaseResource;
Expand All @@ -23,6 +17,7 @@
import io.jans.configapi.plugin.lock.util.Constants;
import io.jans.configapi.util.ApiConstants;
import io.jans.orm.PersistenceEntryManager;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.ArraySchema;
Expand All @@ -31,6 +26,7 @@
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 jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.validation.Valid;
Expand All @@ -40,27 +36,37 @@
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

import java.util.Date;
import java.util.List;

import org.slf4j.Logger;


@Path(Constants.AUDIT)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class AuditResource extends BaseResource {

private static final String EVENT_START_DATE_ISO8601 = "eventStartDateIso8601";
private static final String EVENT_END_DATE_ISO8601 = "eventEndDateIso8601";
private static final String EVENT_START_DATE_PARSE_ERR = "Can't parse event start date !";
private static final String EVENT_END_DATE_PARSE_ERR = "Can't parse event end date !";

@Inject
Logger logger;

@Inject
AuditService auditService;

@Inject
@Named(ApplicationFactory.PERSISTENCE_ENTRY_MANAGER_NAME)
PersistenceEntryManager persistenceEntryManager;

@Operation(summary = "Save health data", description = "Save health data", operationId = "save-health-data", tags = {
"Lock - Audit" }, security = @SecurityRequirement(name = "oauth2", scopes = {
Constants.LOCK_HEALTH_WRITE_ACCESS }))
Expand Down Expand Up @@ -91,29 +97,22 @@ public Response postHealthData(@Valid HealthEntry healthEntry) {
@Path(Constants.HEALTH + ApiConstants.EVENT_RANGE_PATH)
@ProtectedApi(scopes = { Constants.LOCK_HEALTH_READ_ACCESS })
public Response getHealthEntrysByRange(
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Event start date in ISO8601 format") @PathParam("eventStartDate") @NotNull String eventStartDateIso8601,
@Parameter(description = "Event end date in ISO8601 format") @PathParam("eventEndtDate") @NotNull String eventEndDateIso8601) {
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Event start date in ISO8601 format") @QueryParam("eventStartDate") @NotNull String eventStartDateIso8601,
@Parameter(description = "Event end date in ISO8601 format") @QueryParam("eventEndtDate") @NotNull String eventEndDateIso8601) {
logger.debug("Get Health entries by by event range");

if (StringUtils.isBlank(eventStartDateIso8601)) {
throwBadRequestException("Event start date should not be null or empty !");
}
checkNotNull(eventStartDateIso8601, EVENT_START_DATE_ISO8601);
checkNotNull(eventEndDateIso8601, EVENT_END_DATE_ISO8601);

if (StringUtils.isBlank(eventEndDateIso8601)) {
throwBadRequestException("Event end date should not be null or empty !");
}
Date eventStartDate = persistenceEntryManager.decodeTime(auditService.getDnForHealthEntry(null),
eventStartDateIso8601);
checkResourceNotNull(eventStartDate, EVENT_START_DATE_PARSE_ERR);

Date eventStartDate = persistenceEntryManager.decodeTime(auditService.getDnForHealthEntry(null), eventStartDateIso8601);
if (eventStartDate == null) {
throwBadRequestException("Can't parse event start date !");
}
Date eventEndDate = persistenceEntryManager.decodeTime(auditService.getDnForHealthEntry(null),
eventEndDateIso8601);
checkResourceNotNull(eventEndDate, EVENT_END_DATE_PARSE_ERR);

Date eventEndDate = persistenceEntryManager.decodeTime(auditService.getDnForHealthEntry(null), eventEndDateIso8601);
if (eventEndDate == null) {
throwBadRequestException("Can't parse event end date !");
}

List<HealthEntry> entries = auditService.getHealthEntrysByRange(eventStartDate, eventEndDate, limit);
return Response.ok(entries).build();
}
Expand Down Expand Up @@ -148,29 +147,22 @@ public Response postLogData(@Valid LogEntry logEntry) {
@Path(Constants.LOG + ApiConstants.EVENT_RANGE_PATH)
@ProtectedApi(scopes = { Constants.LOCK_LOG_READ_ACCESS })
public Response getLogEntrysByRange(
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Event start date in ISO8601 format") @PathParam("eventStartDate") @NotNull String eventStartDateIso8601,
@Parameter(description = "Event end date in ISO8601 format") @PathParam("eventEndtDate") @NotNull String eventEndDateIso8601) {
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Event start date in ISO8601 format") @QueryParam("eventStartDate") @NotNull String eventStartDateIso8601,
@Parameter(description = "Event end date in ISO8601 format") @QueryParam("eventEndtDate") @NotNull String eventEndDateIso8601) {
logger.debug("Get Log entries by by event range");

if (StringUtils.isBlank(eventStartDateIso8601)) {
throwBadRequestException("Event start date should not be null or empty !");
}
checkNotNull(eventStartDateIso8601, EVENT_START_DATE_ISO8601);
checkNotNull(eventEndDateIso8601, EVENT_END_DATE_ISO8601);

if (StringUtils.isBlank(eventEndDateIso8601)) {
throwBadRequestException("Event end date should not be null or empty !");
}
Date eventStartDate = persistenceEntryManager.decodeTime(auditService.getDnForLogEntry(null),
eventStartDateIso8601);
checkResourceNotNull(eventStartDate, EVENT_START_DATE_PARSE_ERR);

Date eventStartDate = persistenceEntryManager.decodeTime(auditService.getDnForLogEntry(null), eventStartDateIso8601);
if (eventStartDate == null) {
throwBadRequestException("Can't parse event start date !");
}
Date eventEndDate = persistenceEntryManager.decodeTime(auditService.getDnForLogEntry(null),
eventEndDateIso8601);
checkResourceNotNull(eventEndDate, EVENT_END_DATE_PARSE_ERR);

Date eventEndDate = persistenceEntryManager.decodeTime(auditService.getDnForLogEntry(null), eventEndDateIso8601);
if (eventEndDate == null) {
throwBadRequestException("Can't parse event end date !");
}

List<LogEntry> entries = auditService.getLogEntrysByRange(eventStartDate, eventEndDate, limit);
return Response.ok(entries).build();
}
Expand Down Expand Up @@ -204,29 +196,22 @@ public Response postTelemetryData(@Valid TelemetryEntry telemetryEntry) {
@Path(Constants.TELEMETRY + ApiConstants.EVENT_RANGE_PATH)
@ProtectedApi(scopes = { Constants.LOCK_TELEMETRY_READ_ACCESS })
public Response getTelemetryEntrysByRange(
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Event start date in ISO8601 format") @PathParam("eventStartDate") @NotNull String eventStartDateIso8601,
@Parameter(description = "Event end date in ISO8601 format") @PathParam("eventEndtDate") @NotNull String eventEndDateIso8601) {
@Parameter(description = "Search size - max size of the results to return") @DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@Parameter(description = "Event start date in ISO8601 format") @QueryParam("eventStartDate") @NotNull String eventStartDateIso8601,
@Parameter(description = "Event end date in ISO8601 format") @QueryParam("eventEndtDate") @NotNull String eventEndDateIso8601) {
logger.debug("Get Telemetry entries by by event range");

if (StringUtils.isBlank(eventStartDateIso8601)) {
throwBadRequestException("Event start date should not be null or empty !");
}
checkNotNull(eventStartDateIso8601, EVENT_START_DATE_ISO8601);
checkNotNull(eventEndDateIso8601, EVENT_END_DATE_ISO8601);

if (StringUtils.isBlank(eventEndDateIso8601)) {
throwBadRequestException("Event end date should not be null or empty !");
}
Date eventStartDate = persistenceEntryManager.decodeTime(auditService.getDnForTelemetryEntry(null),
eventStartDateIso8601);
checkResourceNotNull(eventStartDate, EVENT_START_DATE_PARSE_ERR);

Date eventStartDate = persistenceEntryManager.decodeTime(auditService.getDnForTelemetryEntry(null), eventStartDateIso8601);
if (eventStartDate == null) {
throwBadRequestException("Can't parse event start date !");
}
Date eventEndDate = persistenceEntryManager.decodeTime(auditService.getDnForTelemetryEntry(null),
eventEndDateIso8601);
checkResourceNotNull(eventEndDate, EVENT_END_DATE_PARSE_ERR);

Date eventEndDate = persistenceEntryManager.decodeTime(auditService.getDnForTelemetryEntry(null), eventEndDateIso8601);
if (eventEndDate == null) {
throwBadRequestException("Can't parse event end date !");
}

List<TelemetryEntry> entries = auditService.getTelemetryEntrysByRange(eventStartDate, eventEndDate, limit);
return Response.ok(entries).build();
}
Expand Down