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(config-api): new endpoint for jans service status and file type script enhancement #10014

Merged
merged 171 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 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
7c7b1b2
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 12, 2024
a53c1f3
feat(config-api): client token functionality
pujavs Sep 12, 2024
7845e14
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 13, 2024
84bfda6
fix(Config-api): lock audit endpoint path param rectification
pujavs Sep 13, 2024
930de96
feat(config-api): sysnc with main
pujavs Sep 13, 2024
2101295
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 13, 2024
83596a4
feat(config-api): clint token endpoint - wip
pujavs Sep 13, 2024
eafad7e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 17, 2024
8a6766a
feat(config-api): clint token endpoint
pujavs Sep 17, 2024
07e1a8e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 18, 2024
189d6b0
feat(config-api): client token endpoint
pujavs Sep 19, 2024
ab9687a
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 19, 2024
1878163
feat(config-api): client token endpoint
pujavs Sep 20, 2024
33c6795
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 20, 2024
b18c2f4
feat(config-api): token endpoint
pujavs Sep 20, 2024
89a18b2
feat(config-api): token endpoint
pujavs Sep 20, 2024
685195e
Merge branch 'main' into jans-config-fix
yuriyz Sep 20, 2024
256aff3
feat(config-api): token endpoint
pujavs Sep 20, 2024
9147254
Merge branch 'jans-config-fix' of https://github.com/JanssenProject/j…
pujavs Sep 20, 2024
21dabff
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 23, 2024
ae9b325
feat(config-api): session ednpoint wip
pujavs Sep 24, 2024
383064e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 24, 2024
0ca4a9b
feat(config-api): session ednpoint wip
pujavs Sep 24, 2024
ea54289
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 25, 2024
1baec33
feat(config-api): session and token endpoint
pujavs Sep 25, 2024
9c49ad6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 26, 2024
cccf083
feat(config-api): session endpoint
pujavs Sep 27, 2024
28a2fc4
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 27, 2024
648fcea
feat(config-api): session endpoint
pujavs Sep 27, 2024
4e64acd
feat(config-api): session and fido2 endpoint
pujavs Sep 27, 2024
df22bb9
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 27, 2024
23e09af
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 27, 2024
78d045e
test(config-api): marked session failing test case
pujavs Sep 27, 2024
590d625
feat(config-api): asset mgt dir mapping changes wip
pujavs Sep 30, 2024
f27dfe0
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 1, 2024
d13fc8a
feat(config-api): asset mgt dir changes
pujavs Oct 1, 2024
d1a5f02
feat(config-api): asset mgt changes for dir
pujavs Oct 2, 2024
5ff1171
feat(config-api): asset mgt endpoint -wip
pujavs Oct 3, 2024
32d627e
feat(config-api): asset mgt endpoint
pujavs Oct 3, 2024
c74b12f
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 4, 2024
931dcc0
feat(config-api): custom asset mgt wip
pujavs Oct 4, 2024
e65f021
feat(config-api): custom asset mgt
pujavs Oct 4, 2024
8338754
feat(config-api): custom asset mgt
pujavs Oct 4, 2024
5a18595
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 7, 2024
62dc60f
feat(config-api): session endpoint changes to remove sessionId
pujavs Oct 10, 2024
9073e05
feat(config-api) session endpoint changes to hide id
pujavs Oct 11, 2024
ed4b368
feat(config-api) session endpoint changes to hide id
pujavs Oct 11, 2024
321f3fc
feat(config-api): sync with main
pujavs Oct 12, 2024
41cef31
feat(config-api): session endpoint mgt
pujavs Oct 12, 2024
79a9c50
feat(config-api): session enhancement for removing id
pujavs Oct 14, 2024
3fbd543
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
50744dd
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
f86318a
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
b0c2be0
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
d19d230
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 14, 2024
6994ea5
feat(config-api): search fieldValuePair enhancement
pujavs Oct 15, 2024
67e3807
feat(config-api): search fieldValuePair enhancement
pujavs Oct 15, 2024
2b99f77
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 16, 2024
de5e77f
feat(config-api): session field filter enhancement - wip
pujavs Oct 16, 2024
4c146f4
feat(config-api): session field search enhancement wip
pujavs Oct 16, 2024
bfe907a
feat(config-api): session endpoint search enhancemnt
pujavs Oct 17, 2024
d5f9b90
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 17, 2024
5a0ddcb
feat(config-api): session endpoint search enhancemnt
pujavs Oct 17, 2024
6122175
feat(config-api): session endpoint search enhancement
pujavs Oct 17, 2024
0459d2d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 18, 2024
ed44dae
feat(config-api): session and token endpoint enhacement
pujavs Oct 18, 2024
6e4dd02
feat(config-api): session and token search enhancement
pujavs Oct 18, 2024
4c5a74b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 21, 2024
205485f
feat(config-api): session search changes for session attribute
pujavs Oct 21, 2024
521eb38
feat(config-api): fido2 search endpoint
pujavs Oct 21, 2024
1a1ed29
feat(config-api): fido2 entry search
pujavs Oct 22, 2024
ad1ed78
feat(config-api): sync with main
pujavs Oct 22, 2024
dd056b9
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 22, 2024
46738e8
feat(config-api): pagination implemented in fido2, session and token …
pujavs Oct 22, 2024
2fc3605
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 23, 2024
402a624
feat(Config-ap): acr enhacement for agama
pujavs Oct 24, 2024
824f0f7
feat(Config-ap): made asset error message descriptive
pujavs Oct 24, 2024
2c1810b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 28, 2024
ec55bfa
feat(config-api): token date format changes
pujavs Oct 28, 2024
4f0ae0a
feat(config-api): date time changes for tkken comparison:
pujavs Oct 29, 2024
626a330
feat(config-api): date time changes for tkken comparison
pujavs Oct 29, 2024
ad445b8
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 30, 2024
37a6a6c
feat(config-api): sync with main
pujavs Oct 30, 2024
84f0723
feat(config-api): date check
pujavs Oct 30, 2024
3331b80
feat(config-api): date format enhancement - wip
pujavs Oct 30, 2024
c8c08d6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 31, 2024
619b0a0
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 31, 2024
5c2b104
feat(config-api): service status endpoint wip
pujavs Oct 31, 2024
9811743
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 1, 2024
ba4d80c
feat(config-api): new endpoint for jans service status and file type …
pujavs Nov 1, 2024
dfeff28
feat(config-api): new endpoint for jans service status and file type …
pujavs Nov 1, 2024
e92665f
feat(config-api): new endpoint for jans service status and file type …
pujavs Nov 1, 2024
fc4f13f
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 1, 2024
fc1e94b
feat(config-api): new endpoint for jans service status and file type …
pujavs Nov 1, 2024
b44685b
Merge branch 'main' into jans-config-fix
devrimyatar Nov 3, 2024
93dae88
Merge branch 'main' into jans-config-fix
yurem Nov 4, 2024
b1b87ea
Merge branch 'main' into jans-config-fix
pujavs Nov 5, 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
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private ApiConstants() {}
public static final String SEARCH = "/search";
public static final String JANSID_PATH = "/id";
public static final String SID_PATH = "/sid";
public static final String SERVICE_STATUS_PATH = "/service-status";

public static final String APP_VERSION = "/app-version";
public static final String SERVER_STAT = "/server-stat";
Expand Down Expand Up @@ -145,6 +146,7 @@ private ApiConstants() {}
public static final String TOKEN_CODE = "tknCde";
public static final String OUTSIDE_SID = "outsideSid";
public static final String JANS_SESS_ATTR = "jansSessAttr";
public static final String JANS_SERVICE_NAME = "service";


public static final String ALL = "all";
Expand Down
68 changes: 61 additions & 7 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,60 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/StatsData'
examples:
Response json example:
description: Response json example
value: |
{
"dbType": "sql",
"lastUpdate": "2024-11-01T12:11:01",
"facterData": {
"memoryfree": "39.7%",
"swapfree": "0.0%",
"hostname": "pujavs-amazed-rat.gluu.info",
"ipaddress": "167.99.13.66",
"uptime": "1 day, 3:54",
"free_disk_space": "95.4%",
"load_average": "0.13623046875"
}
}
"500":
description: InternalServerError
/api/v1/health/service-status:
get:
tags:
- Health - Check
summary: Fetch service status
description: Fetch service status
operationId: get-service-status
parameters:
- name: service
in: query
description: Service name to check status
schema:
type: string
default: all
responses:
"200":
description: Ok
content:
application/json:
schema:
type: string
examples:
Response json example:
description: Response json example
value: |
{
"jans-auth": "Running",
"jans-config-api": "Down",
"jans-casa": "Not present",
"jans-fido2": "Running",
"jans-scim": "Running",
"jans-link": "Running",
"jans-lock": "Running",
"keycloak": "Running"
}
"500":
description: InternalServerError
/api/v1/acrs:
Expand Down Expand Up @@ -9217,12 +9271,12 @@ components:
type: boolean
adminCanView:
type: boolean
userCanView:
type: boolean
adminCanEdit:
type: boolean
userCanEdit:
type: boolean
userCanView:
type: boolean
adminCanAccess:
type: boolean
userCanAccess:
Expand Down Expand Up @@ -9851,7 +9905,7 @@ components:
type: boolean
disableU2fEndpoint:
type: boolean
deviceSessionLifetimeInSeconds:
authorizationChallengeSessionLifetimeInSeconds:
type: integer
format: int32
rotateDeviceSecret:
Expand Down Expand Up @@ -10074,8 +10128,6 @@ components:
type: boolean
lockMessageConfig:
$ref: '#/components/schemas/LockMessageConfig'
fapi:
type: boolean
allResponseTypesSupported:
uniqueItems: true
type: array
Expand All @@ -10085,6 +10137,8 @@ components:
- code
- token
- id_token
fapi:
type: boolean
AuthenticationFilter:
required:
- baseDn
Expand Down Expand Up @@ -11628,10 +11682,10 @@ components:
ttl:
type: integer
format: int32
persisted:
type: boolean
opbrowserState:
type: string
persisted:
type: boolean
SessionIdAccessMap:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package io.jans.configapi.rest.health;

import static io.jans.as.model.util.Util.escapeLog;

import com.fasterxml.jackson.databind.JsonNode;

import io.jans.configapi.core.model.HealthStatus;
Expand All @@ -21,6 +23,7 @@
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.ArraySchema;
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;
Expand All @@ -32,6 +35,7 @@

import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Map;

@Path(ApiConstants.HEALTH)
@Consumes(MediaType.APPLICATION_JSON)
Expand Down Expand Up @@ -133,7 +137,7 @@ public Response getReadinessResponse() {
@Operation(summary = "Returns application server status", description = "Returns application server status", operationId = "get-server-stat", tags = {
"Health - Check" })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = StatsData.class))),
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = StatsData.class), examples = @ExampleObject(name = "Response json example", value = "example/health/server-stat.json"))),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@GET
@Path(ApiConstants.SERVER_STAT)
Expand All @@ -160,7 +164,25 @@ public Response getApplicationVersion(@Parameter(description = "artifact name fo
return Response.ok(statusCheckerTimer.getAppVersionData(artifact)).build();
}


@Operation(summary = "Fetch service status", description = "Fetch service status", operationId = "get-service-status", tags = {
"Health - Check" })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Map.class), examples = @ExampleObject(name = "Response json example", value = "example/health/service-status.json"))),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@GET
@ProtectedApi(scopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }, groupScopes = {}, superScopes = {})
@Path(ApiConstants.SERVICE_STATUS_PATH)
public Response getServiceStatus(
@Parameter(description = "Service name to check status") @DefaultValue(ApiConstants.ALL) @QueryParam(value = ApiConstants.JANS_SERVICE_NAME) String service) {
if (logger.isInfoEnabled()) {
logger.info("Fetch ServiceStatus info - service:{}", escapeLog(service));
}

Map<String, String> serviceStatus = statusCheckerTimer.getServiceStatus(service);
logger.debug("serviceStatus:{}", serviceStatus);
return Response.ok(serviceStatus).build();
}

private void checkDatabaseConnection() {
configurationService.findConf();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@
import java.util.Set;
import java.util.UUID;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;

@Path(ApiConstants.CONFIG + ApiConstants.SCRIPTS)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class CustomScriptResource extends ConfigBaseResource {

private static final String CUSTOM_FILE_SCRIPT_DEFAULT_LOCATION = "/opt/jans/jetty/jans-auth/custom/script/";
private static final String CUSTOM_SCRIPT = "custom script";
private static final String PATH_SEPARATOR = "/";

Expand Down Expand Up @@ -220,6 +222,10 @@ public Response createScript(@Valid CustomScript customScript,
updateRevision(customScript, null);
customScript.setDn(customScriptService.buildDn(inum));
customScript.setInum(inum);

//custom handling of if ScriptLocationType.FILE - issues#9979
updateFileTypeCustomScript(customScript);

customScriptService.add(customScript);
logger.debug("Custom Script added {}", customScript);
return Response.status(Response.Status.CREATED).entity(customScript).build();
Expand All @@ -245,6 +251,9 @@ public Response updateScript(@Valid @NotNull CustomScript customScript) {
updateRevision(customScript, existingScript);
logger.debug("Custom Script to be updated {}", customScript);

//custom handling of if ScriptLocationType.FILE - issues#9979
updateFileTypeCustomScript(customScript);

customScriptService.update(customScript);

logger.debug("Check if script is enabled:{}", existingScript.isEnabled());
Expand Down Expand Up @@ -469,4 +478,24 @@ private void removeAuthenticationMethod() {
configurationService.merge(gluuConfiguration);
}

private CustomScript updateFileTypeCustomScript(CustomScript customScript) {
logger.info("Handling CustomScript if location type is File - customScript:{}", customScript);
// Handling for File type customScript
if (customScript == null) {
return customScript;
}
logger.info("Handling CustomScript if location type is File - customScript.getLocationType().getValue():{}, customScript.getLocationPath():{}", customScript.getLocationType().getValue(), customScript.getLocationPath());
if (ScriptLocationType.FILE.getValue().equalsIgnoreCase(customScript.getLocationType().getValue())) {
logger.info("Modifying customScript as getLocationType is File - customScript:{}", customScript);
String fileName = CUSTOM_FILE_SCRIPT_DEFAULT_LOCATION;
if (StringUtils.isNotBlank(customScript.getLocationPath())) {
fileName = fileName + FilenameUtils.getName(customScript.getLocationPath());
customScript.setLocationPath(fileName);
}
}

logger.info("Handling CustomScript if location type is File - customScript.getLocationType().getValue():{}, customScript.getLocationPath():{}", customScript.getLocationType().getValue(), customScript.getLocationPath());
return customScript;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,22 @@ public PagedResult<TokenEntity> searchToken(SearchRequest searchRequest) {
searchRequest.getFilterAssertionValue());
for (String assertionValue : searchRequest.getFilterAssertionValue()) {
logger.info("Session Search with assertionValue:{}", assertionValue);
String[] targetArray = new String[] { assertionValue };
Filter grantIdFilter = Filter.createSubstringFilter("grtId", null, targetArray, null);
Filter userIdFilter = Filter.createSubstringFilter("usrId", null, targetArray, null);
Filter userDnFilter = Filter.createSubstringFilter("jansUsrDN", null, targetArray, null);
Filter clientIdFilter = Filter.createSubstringFilter("clnId", null, targetArray, null);
Filter scopeFilter = Filter.createSubstringFilter("scp", null, targetArray, null);
Filter tokenTypeFilter = Filter.createSubstringFilter("tknTyp", null, targetArray, null);
Filter grantTypeFilter = Filter.createSubstringFilter("grtTyp", null, targetArray, null);
Filter inumFilter = Filter.createSubstringFilter("jansId", null, targetArray, null);
filters.add(Filter.createORFilter(grantIdFilter, userIdFilter, userDnFilter, clientIdFilter,
scopeFilter, tokenTypeFilter, grantTypeFilter, inumFilter));
if (StringUtils.isNotBlank(assertionValue)) {
String[] targetArray = new String[] { assertionValue };
Filter grantIdFilter = Filter.createSubstringFilter("grtId", null, targetArray, null);
Filter userIdFilter = Filter.createSubstringFilter("usrId", null, targetArray, null);
Filter userDnFilter = Filter.createSubstringFilter("jansUsrDN", null, targetArray, null);
Filter clientIdFilter = Filter.createSubstringFilter("clnId", null, targetArray, null);
Filter scopeFilter = Filter.createSubstringFilter("scp", null, targetArray, null);
Filter tokenTypeFilter = Filter.createSubstringFilter("tknTyp", null, targetArray, null);
Filter grantTypeFilter = Filter.createSubstringFilter("grtTyp", null, targetArray, null);
Filter inumFilter = Filter.createSubstringFilter("jansId", null, targetArray, null);
filters.add(Filter.createORFilter(grantIdFilter, userIdFilter, userDnFilter, clientIdFilter,
scopeFilter, tokenTypeFilter, grantTypeFilter, inumFilter));

}
searchFilter = Filter.createORFilter(filters);
}
searchFilter = Filter.createORFilter(filters);
logger.trace("Search Token searchFilter :{}", searchFilter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

package io.jans.configapi.service.status;

import io.jans.util.process.ProcessHelper;


import com.fasterxml.jackson.databind.JsonNode;

import static io.jans.as.model.util.Util.escapeLog;

import io.jans.configapi.configuration.ConfigurationFactory;
import io.jans.configapi.core.util.Jackson;
import io.jans.configapi.model.status.StatsData;
Expand All @@ -21,11 +24,13 @@
import io.jans.service.timer.event.TimerEvent;
import io.jans.service.timer.schedule.TimerSchedule;
import io.jans.util.StringHelper;
import io.jans.util.process.ProcessHelper;

import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

import jakarta.annotation.PostConstruct;
Expand All @@ -48,6 +53,7 @@ public class StatusCheckerTimer {
private static final int DEFAULT_INTERVAL = 5 * 60; // 1 minute
public static final String PROGRAM_FACTER = "facter";
public static final String PROGRAM_SHOW_VERSION = "/opt/jans/printVersion.py";
public static final String SERVICE_STATUS = "/opt/jans/bin/jans_services_status.py";

@Inject
private Logger log;
Expand Down Expand Up @@ -164,7 +170,9 @@ private FacterData getFacterData() {
}

public JsonNode getAppVersionData(String artifact) {
log.debug("Getting application version for artifact:{}", artifact);
if (log.isInfoEnabled()) {
log.debug("Getting application version for artifact:{}", escapeLog(artifact));
}

JsonNode appVersion = null;
if (!isLinux()) {
Expand Down Expand Up @@ -204,6 +212,50 @@ public JsonNode getAppVersionData(String artifact) {
return appVersion;
}

public Map<String, String> getServiceStatus(String serviceName) {
if (log.isInfoEnabled()) {
log.info("Getting status for serviceName:{}", escapeLog(serviceName));
}

Map<String, String> serviceStatus = null;
ObjectMapper mapper = new ObjectMapper();
if (!isLinux()) {
return serviceStatus;
}

CommandLine commandLine = new CommandLine(SERVICE_STATUS);
if (StringUtils.isNotBlank(serviceName) && !serviceName.equalsIgnoreCase(ApiConstants.ALL)) {
commandLine.addArgument(" " + serviceName);
}
commandLine.addArgument("--json");
log.debug("Getting service status for commandLine:{}", commandLine);

String resultOutput;
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(4096);) {

boolean result = ProcessHelper.executeProgram(commandLine, false, 0, bos);
if (!result) {
return serviceStatus;
}

resultOutput = new String(bos.toByteArray(), UTF_8);
log.info("resultOutput:{}", resultOutput);

if (StringUtils.isNotBlank(resultOutput)) {
serviceStatus = mapper.readValue(resultOutput, Map.class);
}

} catch (UnsupportedEncodingException uex) {
log.error("Failed to parse serviceStatus data program {} output", SERVICE_STATUS, uex);
return serviceStatus;
} catch (Exception ex) {
log.error("Failed to execute serviceStatus program {} output", SERVICE_STATUS, ex);
return serviceStatus;
}
log.debug("Service Status data - serviceStatus:{}", serviceStatus);
return serviceStatus;
}

private void printDirectory() {
log.debug("printDirectory");

Expand Down
Loading