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

Feature: manage configurations #81

Merged
merged 13 commits into from
Nov 4, 2024
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ List of permissions:
| `{"entity": "AI_SECRET", "action": "DELETE"}` | Allows users to delete a specific AI secret in `leto-modelizer-admin`. |
| `{"entity": "AI_SECRET", "action": "UPDATE"}` | Allows users to update a specific AI secret in `leto-modelizer-admin`. |
| `{"entity": "AI_SECRET", "action": "ACCESS"}` | Allows users to access a AI secret ui in `leto-modelizer-admin`. |
| `{"entity": "AI_CONFIGURATION", "action": "CREATE"}` | Allows user to register a AI configuration in `leto-modelizer-admin`. |
| `{"entity": "AI_CONFIGURATION", "action": "DELETE"}` | Allows users to delete a specific AI configuration in `leto-modelizer-admin`. |
| `{"entity": "AI_CONFIGURATION", "action": "UPDATE"}` | Allows users to update a specific AI configuration in `leto-modelizer-admin`. |
| `{"entity": "AI_CONFIGURATION", "action": "ACCESS"}` | Allows users to access a AI configuration ui in `leto-modelizer-admin`. |

### Manage roles

Expand Down Expand Up @@ -252,6 +256,7 @@ enabling secure and streamlined user authentication.
| SUPER_ADMINISTRATOR_LOGIN | No | A configuration parameter that defines the username on Github of the SUPER_ADMINISTRATOR. It will create user if it doesn't exist and associate it to the `SUPER_ADMINISTRATOR` role. |
| AI_HOST | No, default: `http://localhost:8585/` | A configuration parameter that defines the host of the ia server, example: http://localhost:8585/api/. If it's not set, users will not be approve to use ia in application. |
| AI_SECRETS_ENCRYPTION_KEY | Yes | The passphrase to encrypt AI secrets in database. |
| AI_CONFIGURATION_ENCRYPTION_KEY | Yes | The passphrase to encrypt AI configuration for securely sharing it with the AI proxy. |

> Notes: `GITHUB_ENTERPRISE_*` variables are only required on self-hosted GitHub.

Expand Down Expand Up @@ -282,7 +287,8 @@ LIBRARY_HOST_WHITELIST=https://github.com/ditrit/
CSRF_TOKEN_TIMEOUT=3600
USER_SESSION_TIMEOUT=3600
AI_HOST=http://locahost:8585/
AI_SECRETS_ENCRYPTION_KEY=THE MOST SECURE PASSPHRASE EVER
AI_SECRETS_ENCRYPTION_KEY=the most secure key for secrets
AI_CONFIGURATION_ENCRYPTION_KEY=the most secure key for configuration
```

See Configuration section for more details.
Expand Down
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.4'
id 'org.springframework.boot' version '3.3.5'
id 'io.spring.dependency-management' version '1.1.6'
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.51.0'
Expand Down Expand Up @@ -44,19 +44,20 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.session:spring-session-jdbc:3.3.2'
implementation 'org.flywaydb:flyway-core:10.20.0'
implementation "org.flywaydb:flyway-database-postgresql:10.20.0"
implementation 'org.springframework.session:spring-session-jdbc:3.3.3'
implementation 'org.flywaydb:flyway-core:10.20.1'
implementation "org.flywaydb:flyway-database-postgresql:10.20.1"
implementation 'commons-lang:commons-lang:2.6'
implementation 'commons-beanutils:commons-beanutils:1.9.4'
implementation 'com.github.erosb:json-sKema:0.18.0'
implementation 'com.hubspot.jinjava:jinjava:2.7.3'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql:42.7.4'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.cucumber:cucumber-java:7.20.1'
testImplementation 'io.cucumber:cucumber-junit:7.20.1'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.11.2'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.11.3'
}

tasks.named('test') {
Expand Down
12 changes: 11 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* Add api endpoints:
* For AI configuration actions on proxy:
* `GET /api/ai/proxy/configuration`, to send configuration on the proxy.
* `GET /api/ai/proxy/descriptions`, to get all configurations descriptions on the proxy.
* For AI configurations:
* `GET /api/ai/configurations`, to get all AI configurations.
* `POST /api/ai/configurations`, to get create an AI configuration.
* `PUT /api/ai/configurations/`, to update multiple AI configurations.
* `GET /api/ai/configurations/[CONFIGURATION_ID]`, to get an AI configuration.
* `PUT /api/ai/configurations/[CONFIGURATION_ID]`, to update an AI configuration.
* `DELETE /api/ai/configurations/[CONFIGURATION_ID]`, to delete an AI configuration.
* For AI secrets:
* `GET /api/ai/secrets`, to get all AI secret keys.
* `GET /api/ai/secrets`, to get all AI secret keys.
* `POST /api/ai/secrets`, to create an AI secret.
* `GET /api/ai/secrets/[SECRET_ID]`, to get an AI secret.
* `PUT /api/ai/secrets/[SECRET_ID]`, to update an AI secret.
Expand Down
1 change: 1 addition & 0 deletions docker-compose-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ services:
CSRF_TOKEN_TIMEOUT: ${CSRF_TOKEN_TIMEOUT:-3600}
USER_SESSION_TIMEOUT: ${USER_SESSION_TIMEOUT:-3600}
AI_SECRETS_ENCRYPTION_KEY: the most secure key for secrets
AI_CONFIGURATION_ENCRYPTION_KEY: the most secure key for configuration

ports:
- "8443:8443"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
LIBRARY_HOST_WHITELIST: http://libraries/
SUPER_ADMINISTRATOR_LOGIN: ${SUPER_ADMINISTRATOR_LOGIN}
AI_SECRETS_ENCRYPTION_KEY: ${AI_SECRETS_ENCRYPTION_KEY}
AI_CONFIGURATION_ENCRYPTION_KEY: ${AI_CONFIGURATION_ENCRYPTION_KEY}
ports:
- "8443:8443"
depends_on:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.ditrit.letomodelizerapi.config;

import com.ditrit.letomodelizerapi.controller.AIConfigurationController;
import com.ditrit.letomodelizerapi.controller.AIController;
import com.ditrit.letomodelizerapi.controller.AISecretController;
import com.ditrit.letomodelizerapi.controller.CsrfController;
import com.ditrit.letomodelizerapi.controller.CurrentUserController;
import com.ditrit.letomodelizerapi.controller.GroupController;
import com.ditrit.letomodelizerapi.controller.HomeController;
import com.ditrit.letomodelizerapi.controller.AIController;
import com.ditrit.letomodelizerapi.controller.LibraryController;
import com.ditrit.letomodelizerapi.controller.PermissionController;
import com.ditrit.letomodelizerapi.controller.RoleController;
Expand Down Expand Up @@ -45,6 +46,7 @@ public JerseyConfig(@Value("${ai.host}") final String aiHost) {
register(CsrfController.class);
register(PermissionController.class);
register(AISecretController.class);
register(AIConfigurationController.class);

if (StringUtils.isNotBlank(aiHost)) {
register(AIController.class);
Expand Down
Loading
Loading