diff --git a/jans-auth-server/persistence-model/pom.xml b/jans-auth-server/persistence-model/pom.xml index 1cbc4c4e65c..61c6ef860f5 100644 --- a/jans-auth-server/persistence-model/pom.xml +++ b/jans-auth-server/persistence-model/pom.xml @@ -77,6 +77,10 @@ io.jans jans-core-document-store + + io.jans + jans-core-message + io.jans jans-orm-model diff --git a/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/configuration/GluuConfiguration.java b/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/configuration/GluuConfiguration.java index 00fd7c1f908..1fc131662df 100644 --- a/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/configuration/GluuConfiguration.java +++ b/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/configuration/GluuConfiguration.java @@ -14,6 +14,7 @@ import io.jans.orm.model.base.InumEntry; import io.jans.service.cache.CacheConfiguration; import io.jans.service.document.store.conf.DocumentStoreConfiguration; +import io.jans.service.message.model.config.MessageConfiguration; import java.io.Serializable; import java.util.List; @@ -40,6 +41,10 @@ public class GluuConfiguration extends InumEntry implements Serializable { @JsonObject private CacheConfiguration cacheConfiguration; + @AttributeName(name = "jansMessageConf") + @JsonObject + private MessageConfiguration messageConfiguration; + @AttributeName(name = "jansDocStoreConf") @JsonObject private DocumentStoreConfiguration documentStoreConfiguration; @@ -75,7 +80,15 @@ public void setCacheConfiguration(CacheConfiguration cacheConfiguration) { this.cacheConfiguration = cacheConfiguration; } - public DocumentStoreConfiguration getDocumentStoreConfiguration() { + public MessageConfiguration getMessageConfiguration() { + return messageConfiguration; + } + + public void setMessageConfiguration(MessageConfiguration messageConfiguration) { + this.messageConfiguration = messageConfiguration; + } + + public DocumentStoreConfiguration getDocumentStoreConfiguration() { return documentStoreConfiguration; } diff --git a/jans-bom/pom.xml b/jans-bom/pom.xml index cf1a255c559..0d766cc4a42 100644 --- a/jans-bom/pom.xml +++ b/jans-bom/pom.xml @@ -160,6 +160,11 @@ jans-core-cache ${project.version} + + io.jans + jans-core-message + ${project.version} + io.jans jans-core-document-store diff --git a/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiAccessConstants.java b/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiAccessConstants.java index 39f86d9332d..f4dff9cb4a7 100644 --- a/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiAccessConstants.java +++ b/jans-config-api/common/src/main/java/io/jans/configapi/util/ApiAccessConstants.java @@ -29,6 +29,9 @@ private ApiAccessConstants() { public static final String CACHE_READ_ACCESS = "https://jans.io/oauth/config/cache.readonly"; public static final String CACHE_WRITE_ACCESS = "https://jans.io/oauth/config/cache.write"; + public static final String MESSAGE_READ_ACCESS = "https://jans.io/oauth/config/message.readonly"; + public static final String MESSAGE_WRITE_ACCESS = "https://jans.io/oauth/config/message.write"; + public static final String SMTP_READ_ACCESS = "https://jans.io/oauth/config/smtp.readonly"; public static final String SMTP_WRITE_ACCESS = "https://jans.io/oauth/config/smtp.write"; public static final String SMTP_DELETE_ACCESS = "https://jans.io/oauth/config/smtp.delete"; 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 321eebc5b17..0192c91b8ca 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 @@ -51,6 +51,7 @@ private ApiConstants() {} public static final String SMTP = "/smtp"; public static final String GRANT_TYPES = "/grant-types"; public static final String CACHE = "/cache"; + public static final String MESSAGE = "/message"; public static final String PERSISTENCE = "/persistence"; public static final String FEATURE_FLAGS = "/feature-flags"; public static final String DATABASE = "/database"; @@ -60,6 +61,7 @@ private ApiConstants() {} public static final String IN_MEMORY = "/in-memory"; public static final String NATIVE_PERSISTENCE = "/native-persistence"; public static final String MEMCACHED = "/memcached"; + public static final String POSTGRES = "/postgres"; public static final String TEST = "/test"; public static final String INUM_PATH = "{inum}"; public static final String ID_PATH = "{id}"; diff --git a/jans-config-api/docs/jans-config-api-swagger.yaml b/jans-config-api/docs/jans-config-api-swagger.yaml index 3d1bfb02073..3328b1dcf4d 100644 --- a/jans-config-api/docs/jans-config-api-swagger.yaml +++ b/jans-config-api/docs/jans-config-api-swagger.yaml @@ -5137,6 +5137,257 @@ paths: security: - oauth2: - https://jans.io/oauth/config/logging.write + /api/v1/config/message: + get: + tags: + - Message Configuration + summary: Returns message configuration. + description: Returns message configuration. + operationId: get-config-message + responses: + "200": + description: Message configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/MessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.readonly + patch: + tags: + - Message Configuration + summary: Patch message configuration. + description: Patch message configuration + operationId: patch-config-message + requestBody: + description: String representing patch-document. + content: + application/json-patch+json: + schema: + type: array + items: + $ref: '#/components/schemas/JsonPatch' + examples: + Request json example: + description: Request json example + value: "" + responses: + "200": + description: Message configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/MessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.write + /api/v1/config/message/postgres: + get: + tags: + - Message Configuration – Postgres + summary: Returns Postgres message configuration. + description: Returns Postgres message configuration. + operationId: get-config-message-postgres + responses: + "200": + description: Native persistence configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/PostgresMessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.readonly + put: + tags: + - Message Configuration – Postgres + summary: Updates Postgres message configuration. + description: Updates Postgres message configuration + operationId: put-config-message-postgres + requestBody: + description: PostgresMessageConfiguration object + content: + application/json: + schema: + $ref: '#/components/schemas/PostgresMessageConfiguration' + examples: + Request json example: + description: Request json example + value: "" + responses: + "200": + description: Native persistence message configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/PostgresMessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.write + patch: + tags: + - Message Configuration – Postgres + summary: Patch Postgres message configuration. + description: Patch Postgres message configuration + operationId: patch-config-message-postgres + requestBody: + description: String representing patch-document. + content: + application/json-patch+json: + schema: + type: array + items: + $ref: '#/components/schemas/JsonPatch' + examples: + Request json example: + description: Request json example + value: "" + responses: + "200": + description: Native persistence message configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/PostgresMessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.write + /api/v1/config/message/redis: + get: + tags: + - Message Configuration – Redis + summary: Returns Redis message configuration. + description: Returns Redis message configuration + operationId: get-config-message-redis + responses: + "200": + description: Redis message configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/RedisMessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.readonly + put: + tags: + - Message Configuration – Redis + summary: Updates Redis message configuration. + description: Updates Redis message configuration + operationId: put-config-message-redis + requestBody: + description: RedisMessageConfiguration object + content: + application/json: + schema: + $ref: '#/components/schemas/RedisMessageConfiguration' + examples: + Request json example: + description: Request json example + value: "" + responses: + "200": + description: Redis message configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/RedisMessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.write + patch: + tags: + - Message Configuration – Redis + summary: Patch Redis message configuration. + description: Patch Redis message configuration + operationId: patch-config-message-redis + requestBody: + description: String representing patch-document. + content: + application/json-patch+json: + schema: + type: array + items: + $ref: '#/components/schemas/JsonPatch' + examples: + Request json example: + description: Request json example + value: "" + responses: + "200": + description: Redis message configuration details + content: + application/json: + schema: + $ref: '#/components/schemas/RedisMessageConfiguration' + examples: + Response json example: + description: Response json example + value: "" + "401": + description: Unauthorized + "500": + description: InternalServerError + security: + - oauth2: + - https://jans.io/oauth/config/message.write /api/v1/org: get: tags: @@ -7607,22 +7858,22 @@ components: $ref: '#/components/schemas/AttributeValidation' tooltip: type: string - whitePagesCanView: - type: boolean - selected: + adminCanView: type: boolean adminCanEdit: type: boolean userCanView: type: boolean - adminCanView: - type: boolean userCanEdit: type: boolean adminCanAccess: type: boolean userCanAccess: type: boolean + whitePagesCanView: + type: boolean + selected: + type: boolean baseDn: type: string PatchRequest: @@ -8548,6 +8799,11 @@ components: type: string scriptsPath: type: string + serializerType: + type: string + enum: + - KRYO + - FST maxItemsLoggedInCollections: type: integer format: int32 @@ -8563,12 +8819,6 @@ components: type: string bridgeScriptPage: type: string - serializeRules: - type: object - additionalProperties: - type: array - items: - type: string defaultResponseHeaders: type: object additionalProperties: @@ -9607,6 +9857,111 @@ components: type: array items: type: string + MessageConfiguration: + type: object + properties: + messageProviderType: + type: string + enum: + - "NULL" + - REDIS + - POSTGRES + nullConfiguration: + $ref: '#/components/schemas/NullMessageConfiguration' + redisConfiguration: + $ref: '#/components/schemas/RedisMessageConfiguration' + postgresConfiguration: + $ref: '#/components/schemas/PostgresMessageConfiguration' + NullMessageConfiguration: + type: object + PostgresMessageConfiguration: + type: object + properties: + dbSchemaName: + type: string + xml: + name: db-schema-name + connectionUri: + type: string + xml: + name: connection-uri + authUserName: + type: string + xml: + name: auth-userName + authUserPassword: + type: string + xml: + name: auth-userPassword + connectionPoolMaxTotal: + type: integer + format: int32 + xml: + name: connection-pool-max-total + connectionPoolMaxIdle: + type: integer + format: int32 + xml: + name: connection-pool-max-idle + connectionPoolMinIdle: + type: integer + format: int32 + xml: + name: connection-pool-min-idle + messageWaitMillis: + type: integer + format: int32 + xml: + name: message-wait-millis + messageSleepThreadTime: + type: integer + format: int32 + xml: + name: message-sleep-thread-millis + RedisMessageConfiguration: + type: object + properties: + redisProviderType: + type: string + enum: + - STANDALONE + - CLUSTER + - SHARDED + - SENTINEL + servers: + type: string + defaultPutExpiration: + type: integer + format: int32 + sentinelMasterGroupName: + type: string + password: + type: string + useSSL: + type: boolean + sslTrustStoreFilePath: + type: string + sslTrustStorePassword: + type: string + sslKeyStoreFilePath: + type: string + sslKeyStorePassword: + type: string + maxIdleConnections: + type: integer + format: int32 + maxTotalConnections: + type: integer + format: int32 + connectionTimeout: + type: integer + format: int32 + soTimeout: + type: integer + format: int32 + maxRetryAttempts: + type: integer + format: int32 GluuOrganization: required: - description diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js index 55d2cf998ca..889c46d1fcb 100644 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js @@ -49,6 +49,7 @@ function() { authConfigurationUrl: baseUrl + '/jans-config-api/api/v1/jans-auth-server/config', scriptsUrl: baseUrl + '/jans-config-api/api/v1/config/scripts', cacheUrl: baseUrl + '/jans-config-api/api/v1/config/cache', + messageUrl: baseUrl + '/jans-config-api/api/v1/config/message', jwksUrl: baseUrl + '/jans-config-api/api/v1/config/jwks', ldapUrl: baseUrl + '/jans-config-api/api/v1/config/database/ldap', openidclients_url: baseUrl + '/jans-config-api/api/v1/openid/clients', diff --git a/jans-config-api/server/pom.xml b/jans-config-api/server/pom.xml index 18eb5cfba8c..de580dda69c 100644 --- a/jans-config-api/server/pom.xml +++ b/jans-config-api/server/pom.xml @@ -27,6 +27,10 @@ io.jans jans-core-model + + io.jans + jans-core-message + io.jans jans-auth-common diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/MessageConfigurationResource.java b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/MessageConfigurationResource.java new file mode 100644 index 00000000000..b055965f56f --- /dev/null +++ b/jans-config-api/server/src/main/java/io/jans/configapi/rest/resource/auth/MessageConfigurationResource.java @@ -0,0 +1,247 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.rest.resource.auth; + +import java.io.IOException; +import java.util.function.Function; + +import com.github.fge.jsonpatch.JsonPatch; +import com.github.fge.jsonpatch.JsonPatchException; + +import io.jans.as.common.service.common.ApplicationFactory; +import io.jans.as.persistence.model.configuration.GluuConfiguration; +import io.jans.configapi.core.rest.ProtectedApi; +import io.jans.configapi.core.util.Jackson; +import io.jans.configapi.service.auth.ConfigurationService; +import io.jans.configapi.util.ApiAccessConstants; +import io.jans.configapi.util.ApiConstants; +import io.jans.orm.PersistenceEntryManager; +import io.jans.service.message.model.config.MessageConfiguration; +import io.jans.service.message.model.config.PostgresMessageConfiguration; +import io.jans.service.message.model.config.RedisMessageConfiguration; +import io.swagger.v3.oas.annotations.Operation; +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.parameters.RequestBody; +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.constraints.NotNull; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.InternalServerErrorException; +import jakarta.ws.rs.PATCH; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +/** + * Configuration endpoints for messages + * + * @author Yuriy Movchan Date: 07/12/2023 + */ +@Path(ApiConstants.CONFIG + ApiConstants.MESSAGE) +@Consumes(MediaType.APPLICATION_JSON) +@Produces(MediaType.APPLICATION_JSON) +public class MessageConfigurationResource extends ConfigBaseResource { + + private static final String ERROR_MSG = "Unable to apply patch."; + + @Inject + ConfigurationService configurationService; + + @Inject + @Named(ApplicationFactory.PERSISTENCE_ENTRY_MANAGER_NAME) + PersistenceEntryManager persistenceManager; + + private MessageConfiguration loadMessageConfiguration() { + return configurationService.findGluuConfiguration().getMessageConfiguration(); + } + + private MessageConfiguration mergeModifiedMessage(Function function) { + final GluuConfiguration gluuConfiguration = configurationService.findGluuConfiguration(); + + final MessageConfiguration modifiedMessage = function.apply(gluuConfiguration.getMessageConfiguration()); + gluuConfiguration.setMessageConfiguration(modifiedMessage); + + persistenceManager.merge(gluuConfiguration); + return modifiedMessage; + } + + @Operation(summary = "Returns message configuration.", description = "Returns message configuration.", operationId = "get-config-message", tags = { + "Message Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_READ_ACCESS })) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Message configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = MessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @GET + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_READ_ACCESS }, groupScopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }) + public Response getMessageConfiguration() { + return Response.ok(loadMessageConfiguration()).build(); + } + + @Operation(summary = "Patch message configuration.", description = "Patch message configuration", operationId = "patch-config-message", tags = { + "Message Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS })) + @RequestBody(description = "String representing patch-document.", content = @Content(mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, array = @ArraySchema(schema = @Schema(implementation = JsonPatch.class)), examples = @ExampleObject(name = "Request json example", value = "example/message/message-patch.json"))) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Message configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = MessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @PATCH + @Consumes(MediaType.APPLICATION_JSON_PATCH_JSON) + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_WRITE_ACCESS }, groupScopes = {}, superScopes = { + ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS }) + public Response patchMessageConfiguration(@NotNull String requestString) { + logger.debug(" MESSAGE details to patch - requestString:{}", requestString); + final MessageConfiguration modifiedMessage = mergeModifiedMessage(message -> { + try { + return Jackson.applyPatch(requestString, message); + } catch (IOException | JsonPatchException e) { + throw new InternalServerErrorException(ERROR_MSG, e); + } + }); + return Response.ok(modifiedMessage).build(); + } + + @Operation(summary = "Returns Redis message configuration.", description = "Returns Redis message configuration", operationId = "get-config-message-redis", tags = { + "Message Configuration – Redis" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_READ_ACCESS })) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Redis message configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = RedisMessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message-redis.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @GET + @Path(ApiConstants.REDIS) + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_READ_ACCESS }, groupScopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }) + public Response getRedisMessageConfiguration() { + return Response.ok(loadMessageConfiguration().getRedisConfiguration()).build(); + } + + @Operation(summary = "Updates Redis message configuration.", description = "Updates Redis message configuration", operationId = "put-config-message-redis", tags = { + "Message Configuration – Redis" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS })) + @RequestBody(description = "RedisMessageConfiguration object", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = RedisMessageConfiguration.class), examples = @ExampleObject(name = "Request json example", value = "example/message/message-redis.json"))) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Redis message configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = RedisMessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message-redis.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @PUT + @Path(ApiConstants.REDIS) + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_WRITE_ACCESS }, groupScopes = {}, superScopes = { + ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS }) + public Response updateRedisMessageConfiguration(@NotNull RedisMessageConfiguration redisConfiguration) { + logger.debug("REDIS MESSAGE details to update - redisConfiguration:{}", redisConfiguration); + final MessageConfiguration modifiedMessage = mergeModifiedMessage(message -> { + message.setRedisConfiguration(redisConfiguration); + return message; + }); + return Response.ok(modifiedMessage.getRedisConfiguration()).build(); + } + + @Operation(summary = "Patch Redis message configuration.", description = "Patch Redis message configuration", operationId = "patch-config-message-redis", tags = { + "Message Configuration – Redis" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS })) + @RequestBody(description = "String representing patch-document.", content = @Content(mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, array = @ArraySchema(schema = @Schema(implementation = JsonPatch.class)), examples = @ExampleObject(name = "Request json example", value = "example/message/message-redis-patch.json"))) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Redis message configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = RedisMessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message-redis.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @PATCH + @Path(ApiConstants.REDIS) + @Consumes(MediaType.APPLICATION_JSON_PATCH_JSON) + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_WRITE_ACCESS }, groupScopes = {}, superScopes = { + ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS }) + public Response patchRedisMessageConfiguration(@NotNull String requestString) { + logger.debug("REDIS MESSAGE details to patch - requestString:{} ", requestString); + mergeModifiedMessage(message -> { + try { + message.setRedisConfiguration( + Jackson.applyPatch(requestString, loadMessageConfiguration().getRedisConfiguration())); + return message; + } catch (IOException | JsonPatchException e) { + throw new InternalServerErrorException(ERROR_MSG, e); + } + }); + return Response.ok(loadMessageConfiguration().getRedisConfiguration()).build(); + } + + @Operation(summary = "Returns Postgres message configuration.", description = "Returns Postgres message configuration.", operationId = "get-config-message-postgres", tags = { + "Message Configuration – Postgres" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_READ_ACCESS })) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Native persistence configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = PostgresMessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message-redis.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @GET + @Path(ApiConstants.POSTGRES) + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_READ_ACCESS }, groupScopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }) + public Response getPostgresConfiguration() { + return Response.ok(loadMessageConfiguration().getPostgresConfiguration()).build(); + } + + @Operation(summary = "Updates Postgres message configuration.", description = "Updates Postgres message configuration", operationId = "put-config-message-postgres", tags = { + "Message Configuration – Postgres" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS })) + @RequestBody(description = "PostgresMessageConfiguration object", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = PostgresMessageConfiguration.class), examples = @ExampleObject(name = "Request json example", value = "example/message/message-redis.json"))) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Native persistence message configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = PostgresMessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message-redis.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @PUT + @Path(ApiConstants.POSTGRES) + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_WRITE_ACCESS }, groupScopes = {}, superScopes = { + ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS }) + public Response updatePostgresMessageConfiguration( + @NotNull PostgresMessageConfiguration postgresMessageConfiguration) { + logger.debug("POSTGRES_PERSISTENCE MESSAGE details to update - postgresMessageConfiguration:{}", + postgresMessageConfiguration); + final MessageConfiguration modifiedMessage = mergeModifiedMessage(message -> { + message.setPostgresConfiguration(postgresMessageConfiguration); + return message; + }); + return Response.ok(modifiedMessage.getPostgresConfiguration()).build(); + } + + @Operation(summary = "Patch Postgres message configuration.", description = "Patch Postgres message configuration", operationId = "patch-config-message-postgres", tags = { + "Message Configuration – Postgres" }, security = @SecurityRequirement(name = "oauth2", scopes = { + ApiAccessConstants.MESSAGE_WRITE_ACCESS })) + @RequestBody(description = "String representing patch-document.", content = @Content(mediaType = MediaType.APPLICATION_JSON_PATCH_JSON, array = @ArraySchema(schema = @Schema(implementation = JsonPatch.class)), examples = @ExampleObject(name = "Request json example", value = "example/message/message-redis-patch.json"))) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Native persistence message configuration details", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = PostgresMessageConfiguration.class), examples = @ExampleObject(name = "Response json example", value = "example/message/message-redis.json"))), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "500", description = "InternalServerError") }) + @PATCH + @Path(ApiConstants.POSTGRES) + @Consumes(MediaType.APPLICATION_JSON_PATCH_JSON) + @ProtectedApi(scopes = { ApiAccessConstants.MESSAGE_WRITE_ACCESS }, groupScopes = {}, superScopes = { + ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS }) + public Response patchPostgresMessageConfiguration(@NotNull String requestString) { + logger.debug("POSTGRES_PERSISTENCE MESSAGE details to patch - requestString:{} ", requestString); + mergeModifiedMessage(message -> { + try { + message.setPostgresConfiguration( + Jackson.applyPatch(requestString, message.getPostgresConfiguration())); + return message; + } catch (IOException | JsonPatchException e) { + throw new InternalServerErrorException(ERROR_MSG, e); + } + }); + return Response.ok(loadMessageConfiguration().getPostgresConfiguration()).build(); + } + +} diff --git a/jans-config-api/server/src/test/resources/feature/config/message/message.feature b/jans-config-api/server/src/test/resources/feature/config/message/message.feature new file mode 100644 index 00000000000..3198f3d83f5 --- /dev/null +++ b/jans-config-api/server/src/test/resources/feature/config/message/message.feature @@ -0,0 +1,176 @@ + +Feature: Verify Message configuration endpoint + + Background: + * def mainUrl = messageUrl + + @message-get-error + Scenario: Retrieve Message configuration without bearer token + Given url mainUrl + When method GET + Then status 401 + And print response + + @message-get + Scenario: Retrieve Message configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + When method GET + Then status 200 + And print response + And assert response.length != null + + @message-patch + Scenario: Patch messageProviderType configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + When method GET + Then status 200 + And print response + And assert response.length != null + And print response.messageProviderType + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And header Content-Type = 'application/json-patch+json' + And header Accept = 'application/json' + And request "[ {\"op\":\"replace\", \"path\": \"/messageProviderType\", \"value\":\""+response.messageProviderType+"\" } ]" + Then print request + When method PATCH + Then status 200 + And print response + + @message-patch + Scenario: Patch redisConfiguration configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + When method GET + Then status 200 + And print response + And assert response.length != null + And print response.redisConfiguration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And header Content-Type = 'application/json-patch+json' + And header Accept = 'application/json' + And request "[ {\"op\":\"replace\", \"path\": \"/redisConfiguration\", \"value\":"+response.redisConfiguration+" } ]" + Then print request + When method PATCH + Then status 200 + And print response + + @message-patch + Scenario: Patch postgresConfiguration configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + When method GET + Then status 200 + And print response + And assert response.length != null + And print response.postgresConfiguration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And header Content-Type = 'application/json-patch+json' + And header Accept = 'application/json' + And request "[ {\"op\":\"replace\", \"path\": \"/postgresConfiguration\", \"value\":"+response.postgresConfiguration+" } ]" + Then print request + When method PATCH + Then status 200 + And print response + + @message-get-redis + Scenario: Retrieve Redis message configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'redis' + When method GET + Then status 200 + And print response + And assert response.length != null + + @message-put-redis + Scenario: Update Redis message configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'redis' + When method GET + Then status 200 + Then print response + Then def first_response = response + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'redis' + And request first_response + When method PUT + Then status 200 + And print response + And assert response.length != null + + @message-patch-redis + Scenario: Patch Redis message configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'redis' + When method GET + Then status 200 + And print response + And assert response.length != null + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And header Content-Type = 'application/json-patch+json' + And header Accept = 'application/json' + And request "[ {\"op\":\"replace\", \"path\": \"/servers\", \"value\":"+response.servers+"} ]" + And path 'redis' + Then print request + When method PATCH + Then status 200 + And print response + + @message-get-postgres + Scenario: Retrieve Postgres message configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'postgres' + When method GET + Then status 200 + And print response + And assert response.length != null + + @message-put-postgres + Scenario: Update Postgres message configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'postgres' + When method GET + Then status 200 + Then print response + Then def first_response = response + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'postgres' + And request first_response + When method PUT + Then status 200 + And print response + And assert response.length != null + + @message-patch-postgres + Scenario: Patch Postgres message configuration + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And path 'postgres' + When method GET + Then status 200 + And print response + And assert response.length != null + Given url mainUrl + And header Authorization = 'Bearer ' + accessToken + And header Content-Type = 'application/json-patch+json' + And header Accept = 'application/json' + And request "[ {\"op\":\"replace\", \"path\": \"/dbSchemaName\", \"value\":"+response.dbSchemaName+"} ]" + And path 'postgres' + Then print request + When method PATCH + Then status 200 + And print response + + \ No newline at end of file diff --git a/jans-config-api/server/src/test/resources/karate-config-jenkins.js b/jans-config-api/server/src/test/resources/karate-config-jenkins.js index 4e2eae47e46..f7c06a1578d 100644 --- a/jans-config-api/server/src/test/resources/karate-config-jenkins.js +++ b/jans-config-api/server/src/test/resources/karate-config-jenkins.js @@ -49,6 +49,7 @@ function() { authConfigurationUrl: baseUrl + '/jans-config-api/api/v1/jans-auth-server/config', scriptsUrl: baseUrl + '/jans-config-api/api/v1/config/scripts', cacheUrl: baseUrl + '/jans-config-api/api/v1/config/cache', + messageUrl: baseUrl + '/jans-config-api/api/v1/config/message', jwksUrl: baseUrl + '/jans-config-api/api/v1/config/jwks', ldapUrl: baseUrl + '/jans-config-api/api/v1/config/database/ldap', openidclients_url: baseUrl + '/jans-config-api/api/v1/openid/clients', diff --git a/jans-config-api/server/src/test/resources/karate-config.js b/jans-config-api/server/src/test/resources/karate-config.js index 17b38c4cf05..736808dc83e 100644 --- a/jans-config-api/server/src/test/resources/karate-config.js +++ b/jans-config-api/server/src/test/resources/karate-config.js @@ -49,6 +49,7 @@ function() { authConfigurationUrl: baseUrl + '/jans-config-api/api/v1/jans-auth-server/config', scriptsUrl: baseUrl + '/jans-config-api/api/v1/config/scripts', cacheUrl: baseUrl + '/jans-config-api/api/v1/config/cache', + messageUrl: baseUrl + '/jans-config-api/api/v1/config/message', jwksUrl: baseUrl + '/jans-config-api/api/v1/config/jwks', ldapUrl: baseUrl + '/jans-config-api/api/v1/config/database/ldap', openidclients_url: baseUrl + '/jans-config-api/api/v1/openid/clients', diff --git a/jans-core/message/pom.xml b/jans-core/message/pom.xml index d2cd8afdd80..8d56f1c07a9 100644 --- a/jans-core/message/pom.xml +++ b/jans-core/message/pom.xml @@ -7,7 +7,7 @@ io.jans jans-core-parent - 1.0.20 + 1.0.21-SNAPSHOT diff --git a/jans-core/message/src/main/java/io/jans/service/message/NullMessageProvider.java b/jans-core/message/src/main/java/io/jans/service/message/NullMessageProvider.java index 48655ef6400..ecd9bac8563 100644 --- a/jans-core/message/src/main/java/io/jans/service/message/NullMessageProvider.java +++ b/jans-core/message/src/main/java/io/jans/service/message/NullMessageProvider.java @@ -10,7 +10,6 @@ import org.slf4j.Logger; -import io.jans.service.cache.RedisConfiguration; import io.jans.service.message.model.config.MessageConfiguration; import io.jans.service.message.model.config.MessageProviderType; import io.jans.service.message.pubsub.PubSubInterface; @@ -39,8 +38,8 @@ public void init() { public void create(ExecutorService executorService) { } - public void create(RedisConfiguration redisConfiguration) { - log.debug("Starting NullProvider messages ... configuration {}", redisConfiguration); + public void create() { + log.debug("Starting NullProvider messages ... configuration"); log.debug("NullProvider message started."); } diff --git a/jans-core/message/src/main/java/io/jans/service/message/PostgresMessageProvider.java b/jans-core/message/src/main/java/io/jans/service/message/PostgresMessageProvider.java index 76fbed80940..53d7c1a18b8 100644 --- a/jans-core/message/src/main/java/io/jans/service/message/PostgresMessageProvider.java +++ b/jans-core/message/src/main/java/io/jans/service/message/PostgresMessageProvider.java @@ -80,7 +80,7 @@ public void create(ExecutorService executorService) { try { PostgresMessageConfiguration postgresMessageConfiguration = messageConfiguration - .getPostgresMessageConfiguration(); + .getPostgresConfiguration(); Properties connectionProperties = toPostgresProperties(postgresMessageConfiguration); log.debug("Starting PostgresMessageProvider messages ... configuration {}", postgresMessageConfiguration); @@ -281,7 +281,7 @@ public void unsubscribe() throws SQLException { public void run() { PostgresMessageConfiguration postgresMessageConfiguration = messageConfiguration - .getPostgresMessageConfiguration(); + .getPostgresConfiguration(); int messageWaitMillis = postgresMessageConfiguration.getMessageWaitMillis(); int messageSleepThreadTime = postgresMessageConfiguration.getMessageSleepThreadTime(); diff --git a/jans-core/message/src/main/java/io/jans/service/message/RedisMessageProvider.java b/jans-core/message/src/main/java/io/jans/service/message/RedisMessageProvider.java index db251a73980..ebe286e0571 100644 --- a/jans-core/message/src/main/java/io/jans/service/message/RedisMessageProvider.java +++ b/jans-core/message/src/main/java/io/jans/service/message/RedisMessageProvider.java @@ -21,6 +21,7 @@ import io.jans.service.cache.RedisProviderFactory; import io.jans.service.message.model.config.MessageConfiguration; import io.jans.service.message.model.config.MessageProviderType; +import io.jans.service.message.model.config.RedisMessageConfiguration; import io.jans.service.message.pubsub.PubSubInterface; import io.jans.service.message.pubsub.PubSubRedisAdapter; import io.jans.util.security.StringEncrypter; @@ -77,7 +78,7 @@ public void create(ExecutorService executorService) { this.subscibedPubSubs = new ConcurrentHashMap<>(); try { - RedisConfiguration redisConfiguration = messageConfiguration.getRedisConfiguration(); + RedisMessageConfiguration redisConfiguration = messageConfiguration.getRedisConfiguration(); decryptPassword(redisConfiguration); log.debug("Starting RedisMessageProvider messages ... configuration {}", redisConfiguration); redisProvider = RedisProviderFactory.create(redisConfiguration); @@ -95,7 +96,7 @@ public void configure(MessageConfiguration messageConfiguration, StringEncrypter this.stringEncrypter = stringEncrypter; } - private void decryptPassword(RedisConfiguration redisConfiguration) { + private void decryptPassword(RedisMessageConfiguration redisConfiguration) { try { String encryptedPassword = redisConfiguration.getPassword(); if (StringUtils.isNotBlank(encryptedPassword)) { diff --git a/jans-core/message/src/main/java/io/jans/service/message/model/config/MessageConfiguration.java b/jans-core/message/src/main/java/io/jans/service/message/model/config/MessageConfiguration.java index 658b7c6641d..1a8c70b1a73 100644 --- a/jans-core/message/src/main/java/io/jans/service/message/model/config/MessageConfiguration.java +++ b/jans-core/message/src/main/java/io/jans/service/message/model/config/MessageConfiguration.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import io.jans.service.cache.RedisConfiguration; import jakarta.enterprise.inject.Vetoed; /** @@ -26,9 +25,9 @@ public class MessageConfiguration implements Serializable { private NullMessageConfiguration nullConfiguration = new NullMessageConfiguration(); - private RedisConfiguration redisConfiguration; + private RedisMessageConfiguration redisConfiguration; - private PostgresMessageConfiguration postgresMessageConfiguration; + private PostgresMessageConfiguration postgresConfiguration; public MessageProviderType getMessageProviderType() { return messageProviderType; @@ -46,26 +45,26 @@ public void setNullConfiguration(NullMessageConfiguration nullConfiguration) { this.nullConfiguration = nullConfiguration; } - public PostgresMessageConfiguration getPostgresMessageConfiguration() { - return postgresMessageConfiguration; + public PostgresMessageConfiguration getPostgresConfiguration() { + return postgresConfiguration; } - public void setPostgresMessageConfiguration(PostgresMessageConfiguration postgresMessageConfiguration) { - this.postgresMessageConfiguration = postgresMessageConfiguration; + public void setPostgresConfiguration(PostgresMessageConfiguration postgresMessageConfiguration) { + this.postgresConfiguration = postgresMessageConfiguration; } - public RedisConfiguration getRedisConfiguration() { + public RedisMessageConfiguration getRedisConfiguration() { return redisConfiguration; } - public void setRedisConfiguration(RedisConfiguration redisConfiguration) { + public void setRedisConfiguration(RedisMessageConfiguration redisConfiguration) { this.redisConfiguration = redisConfiguration; } @Override public String toString() { - return "CacheConfiguration{" + "cacheProviderType=" + messageProviderType + ", nullConfiguration=" - + nullConfiguration + ", redisConfiguration=" + redisConfiguration + ", postgresMessageConfiguration=" - + postgresMessageConfiguration + '}'; + return "MessageConfiguration [messageProviderType=" + messageProviderType + ", nullConfiguration=" + + nullConfiguration + ", redisConfiguration=" + redisConfiguration + ", postgresConfiguration=" + + postgresConfiguration + "]"; } } diff --git a/jans-core/message/src/main/java/io/jans/service/message/model/config/PostgresMessageConfiguration.java b/jans-core/message/src/main/java/io/jans/service/message/model/config/PostgresMessageConfiguration.java index cf8ce6e1b57..f103fd9217e 100644 --- a/jans-core/message/src/main/java/io/jans/service/message/model/config/PostgresMessageConfiguration.java +++ b/jans-core/message/src/main/java/io/jans/service/message/model/config/PostgresMessageConfiguration.java @@ -18,31 +18,31 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class PostgresMessageConfiguration implements Serializable { - @XmlElement(name = "db.schema.name") + @XmlElement(name = "db-schema-name") private String dbSchemaName; - @XmlElement(name = "connection.uri") + @XmlElement(name = "connection-uri") private String connectionUri; - @XmlElement(name = "auth.userName") + @XmlElement(name = "auth-userName") private String authUserName; - @XmlElement(name = "auth.userPassword") + @XmlElement(name = "auth-userPassword") private String authUserPassword; - @XmlElement(name = "connection.pool.max-total") + @XmlElement(name = "connection-pool-max-total") private Integer connectionPoolMaxTotal; - @XmlElement(name = "connection.pool.max-idle") + @XmlElement(name = "connection-pool-max-idle") private Integer connectionPoolMaxIdle; - @XmlElement(name = "connection.pool.min-idle") + @XmlElement(name = "connection-pool-min-idle") private Integer connectionPoolMinIdle; - @XmlElement(name = "message.wait-millis") + @XmlElement(name = "message-wait-millis") private Integer messageWaitMillis; - @XmlElement(name = "message.sleep-thread-millis") + @XmlElement(name = "message-sleep-thread-millis") private Integer messageSleepThreadTime; public String getDbSchemaName() { diff --git a/jans-core/message/src/main/java/io/jans/service/message/model/config/RedisMessageConfiguration.java b/jans-core/message/src/main/java/io/jans/service/message/model/config/RedisMessageConfiguration.java new file mode 100644 index 00000000000..e7807a39a78 --- /dev/null +++ b/jans-core/message/src/main/java/io/jans/service/message/model/config/RedisMessageConfiguration.java @@ -0,0 +1,18 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2023, Janssen Project + */ + +package io.jans.service.message.model.config; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import io.jans.service.cache.RedisConfiguration; + +/** + * @author Yuriy Movchan Date: 07/12/2023 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class RedisMessageConfiguration extends RedisConfiguration { +} diff --git a/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandalonePostresMessageTest.java b/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandalonePostresMessageTest.java index ce0f9178415..32da982f107 100644 --- a/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandalonePostresMessageTest.java +++ b/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandalonePostresMessageTest.java @@ -34,7 +34,7 @@ public static void main(String[] args) throws EncryptionException, InterruptedEx postgresMessageConfiguration.setMessageWaitMillis(100); postgresMessageConfiguration.setMessageSleepThreadTime(200); - messageConfiguration.setPostgresMessageConfiguration(postgresMessageConfiguration); + messageConfiguration.setPostgresConfiguration(postgresMessageConfiguration); StandaloneMessageProviderFactory messageProviderFactory = new StandaloneMessageProviderFactory(stringEncrypter); MessageProvider messageProvider = messageProviderFactory.getMessageProvider(messageConfiguration); diff --git a/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandaloneRedisMessageTest.java b/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandaloneRedisMessageTest.java index cf3ac354712..b11c78d2f9d 100644 --- a/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandaloneRedisMessageTest.java +++ b/jans-core/message/src/test/java/io/jans/service/message/test/dev/StandaloneRedisMessageTest.java @@ -6,11 +6,11 @@ package io.jans.service.message.test.dev; -import io.jans.service.cache.RedisConfiguration; import io.jans.service.message.MessageProvider; import io.jans.service.message.StandaloneMessageProviderFactory; import io.jans.service.message.model.config.MessageConfiguration; import io.jans.service.message.model.config.MessageProviderType; +import io.jans.service.message.model.config.RedisMessageConfiguration; import io.jans.service.message.pubsub.PubSubInterface; import io.jans.util.security.StringEncrypter; import io.jans.util.security.StringEncrypter.EncryptionException; @@ -26,7 +26,7 @@ public static void main(String[] args) throws EncryptionException, InterruptedEx MessageConfiguration messageConfiguration = new MessageConfiguration(); messageConfiguration.setMessageProviderType(MessageProviderType.REDIS); - RedisConfiguration redisMessageConfiguration = new RedisConfiguration(); + RedisMessageConfiguration redisMessageConfiguration = new RedisMessageConfiguration(); redisMessageConfiguration.setServers("192.168.1.151:6379"); redisMessageConfiguration.setPassword("rgy1GUg+1kY="); // secret diff --git a/jans-linux-setup/jans_setup/schema/jans_schema.json b/jans-linux-setup/jans_setup/schema/jans_schema.json index 854ae58e3d3..12e52aac47f 100644 --- a/jans-linux-setup/jans_setup/schema/jans_schema.json +++ b/jans-linux-setup/jans_setup/schema/jans_schema.json @@ -2545,6 +2545,18 @@ "syntax": "1.3.6.1.4.1.1466.115.121.1.15", "x_origin": "Jans created attribute" }, + { + "desc": "Message configuration", + "equality": "caseIgnoreMatch", + "names": [ + "jansMessageConf" + ], + "json": true, + "oid": "jansAttr", + "substr": "caseIgnoreSubstringsMatch", + "syntax": "1.3.6.1.4.1.1466.115.121.1.15", + "x_origin": "Jans created attribute" + }, { "desc": "Path to external log4j2.xml", "equality": "caseIgnoreMatch", @@ -3952,6 +3964,7 @@ "jansLogViewerConfig", "jansLogConfigLocation", "jansCacheConf", + "jansMessageConf" "jansDocStoreConf", "jansSoftVer", "userPassword", diff --git a/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json b/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json index 8ed69faacea..4a51307246f 100644 --- a/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json +++ b/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json @@ -110,6 +110,14 @@ "type": "STRING(MAX)" } }, + "jansMessageConf": { + "mysql": { + "type": "TEXT" + }, + "spanner": { + "type": "STRING(MAX)" + } + }, "jansConfApp": { "mysql": { "type": "TEXT" diff --git a/jans-linux-setup/jans_setup/templates/configuration.ldif b/jans-linux-setup/jans_setup/templates/configuration.ldif index fc5998138ac..1a7337ac889 100644 --- a/jans-linux-setup/jans_setup/templates/configuration.ldif +++ b/jans-linux-setup/jans_setup/templates/configuration.ldif @@ -1,5 +1,6 @@ dn: ou=configuration,o=jans jansCacheConf: {"cacheProviderType": "%(cache_provider_type)s", "memcachedConfiguration": {"servers":"localhost:11211", "maxOperationQueueLength":100000, "bufferSize":32768, "defaultPutExpiration":60, "connectionFactoryType": "DEFAULT"}, "inMemoryConfiguration": {"defaultPutExpiration":60}, "nativePersistenceConfiguration": {"defaultPutExpiration":60, "defaultCleanupBatchSize": 10000}, "redisConfiguration":{"servers":"localhost:6379", "defaultPutExpiration": 60}} +jansMessageConf: {"messageProviderType": "NULL", "postgresConfiguration": {"db-schema-name":"public", "message-wait-millis": 100, "message-sleep-thread-millis": 200}, "redisConfiguration":{"servers":"localhost:6379"}} jansDocStoreConf: {"documentStoreType":"LOCAL","localConfiguration":{"baseLocation":"/"},"jcaConfiguration":{"serverUrl":"http://localhost:8080/rmi","workspaceName":"default","connectionTimeout":15,"userId":"admin","password":""},"webDavConfiguration":null} jansDbAuth: {"type": "auth", "name": null, "level": 0, "priority": 1, "enabled": false, "version": 0, "config": {"configId": "auth_ldap_server", "servers": ["%(ldap_hostname)s:%(ldaps_port)s"], "maxConnections": 1000, "bindDN": "%(ldap_binddn)s", "bindPassword": "%(ldap_bind_encoded_pw)s", "useSSL": "true", "baseDNs": ["ou=people,o=jans"], "primaryKey": "uid", "localPrimaryKey": "uid", "useAnonymousBind": false, "enabled": false}} jansSmtpConf: {"key_store":"%(smtp_jks_fn)s", "key_store_password":"%(smtp_jks_pass_enc)s", "key_store_alias":"%(smtp_alias)s", "signing_algorithm":"%(smtp_signing_alg)s"}