[FEAT] clenn
This commit is contained in:
parent
332c65360d
commit
c2bad22ae5
181
README.md
181
README.md
@ -1,103 +1,128 @@
|
|||||||
Karauth
|
Karso
|
||||||
=======
|
=====
|
||||||
|
|
||||||
This repository manage 3 elements:
|
**K**angaroo **A**nd **R**abbit (S)SO is a simple SSO interface that manage multiple application authentication.
|
||||||
- The SSO backend: jersey REST server
|
|
||||||
- The SSO front-end: Angular login interface (KARSO)
|
|
||||||
- The adminitrator of the SSO: Angular adminitration interface of the SSO (KARSO)
|
|
||||||
|
|
||||||
To build the docker image:
|
|
||||||
--------------------------
|
Run in local:
|
||||||
|
=============
|
||||||
|
|
||||||
|
Start tools
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Start the server basic interfaces: (DB(mySQL), Adminer)
|
||||||
|
|
||||||
```{.bash}
|
```{.bash}
|
||||||
gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest
|
# start the Bdd interface (no big data > 50Mo)
|
||||||
|
docker compose -f env_dev/docker-compose.yaml up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
MySql manage multiple users:
|
Start the Back-end:
|
||||||
----------------------------
|
-------------------
|
||||||
|
|
||||||
It is better to not use root user and mange user for each service.
|
backend is developed in JAVA
|
||||||
|
|
||||||
Add a new user
|
The first step is configuring your JAVA version (or select the JVM with the OS)
|
||||||
```sql
|
```bash
|
||||||
CREATE USER 'karso'@'%' IDENTIFIED BY 'base_db_password';
|
export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH
|
||||||
GRANT ALL PRIVILEGES ON `karso`.* TO 'karso'@'%';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
```
|
```
|
||||||
> **_Note_** the `base_db_password` with the production password. this one is for development environment
|
|
||||||
|
|
||||||
|
Install the dependency:
|
||||||
|
```bash
|
||||||
|
mvn install
|
||||||
|
```
|
||||||
|
|
||||||
To start the service
|
Run the test
|
||||||
|
```bash
|
||||||
|
mvn test
|
||||||
|
```
|
||||||
|
|
||||||
|
Install it for external use
|
||||||
|
```bash
|
||||||
|
mvn install
|
||||||
|
```
|
||||||
|
|
||||||
|
Execute the local server:
|
||||||
|
```bash
|
||||||
|
mvn exec:java@dev-mode
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the Front-end:
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
```{.bash}
|
backend is developed in JAVA
|
||||||
docker-compose up -d
|
```bash
|
||||||
|
cd front
|
||||||
|
pnpm install
|
||||||
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** you can manage a single Docker interface to manage all the KAR engine
|
Display the result:
|
||||||
|
-------------------
|
||||||
|
|
||||||
docker login gitea.atria-soft.org
|
[show the webpage: http://localhost:4200](http://localhost:4200)
|
||||||
|
|
||||||
docker pull archlinux:base-devel
|
|
||||||
docker pull bellsoft/liberica-openjdk-alpine:latest
|
|
||||||
|
|
||||||
docker build -t gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest .
|
|
||||||
|
|
||||||
docker push gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
npx playwright test
|
|
||||||
Runs the end-to-end tests.
|
|
||||||
|
|
||||||
npx playwright test --project=firefox
|
|
||||||
Runs the tests only on Desktop Chrome.
|
|
||||||
|
|
||||||
npx playwright test example
|
|
||||||
Runs the tests in a specific file.
|
|
||||||
|
|
||||||
npx playwright test --debug
|
|
||||||
Runs the tests in debug mode.
|
|
||||||
|
|
||||||
npx playwright codegen
|
|
||||||
Auto generate tests with Codegen.
|
|
||||||
|
|
||||||
We suggest that you begin by typing:
|
|
||||||
|
|
||||||
npx playwright test
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Action a faire d'urgence:
|
|
||||||
- Mettre un jenkins en place
|
|
||||||
- dev sur develop et non master
|
|
||||||
- concevoir un système de migration et d'initialisation.
|
|
||||||
- ajouter une interface a sqlWrapper pour supporter sqlite ==> plus facile pour les tests
|
|
||||||
- mettre des test unitaire sur les API REST:
|
|
||||||
- securité des interfaces
|
|
||||||
- viole des token
|
|
||||||
- Fin de validité d'un tocken
|
|
||||||
- Addaque d-DOS
|
|
||||||
- Publier toutes les semaine une version a jour
|
|
||||||
- faire de la documentation pour l'aide
|
|
||||||
- revoir l'interface des paramètre pour la ganérisé
|
|
||||||
- Mettre en place une meilleur page d'acceuil
|
|
||||||
- mettre en config le nom du site
|
|
||||||
- faire un tool qui permet de savoir si le serveur est UP et si ce n'est pas le cas, bloquer l'affichage
|
|
||||||
- mettre en place les coors pour les pages d'administration ==> ca vas ètre coton...
|
|
||||||
- améliorer la gestion et l'affichages des erreur
|
|
||||||
- mettre en place des pop-up de détection d'erreur
|
|
||||||
- mise en place d'envoie d'email pour faire une autentification plus sérieuse.
|
|
||||||
- mettre un place un back-end LDAP
|
|
||||||
|
|
||||||
|
|
||||||
|
Some other dev tools:
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Format code:
|
||||||
|
------------
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH
|
export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH
|
||||||
mvn formatter:format
|
mvn formatter:format
|
||||||
mvn test
|
mvn test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Tools in production mode
|
||||||
|
========================
|
||||||
|
|
||||||
|
Changing the Log Level
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
In a production environment, you can adjust the log level to help diagnose bugs more effectively.
|
||||||
|
|
||||||
|
The available log levels are:
|
||||||
|
| **Log Level Tag** | **org.kar.karso** | **org.kar.archidata** | **other** |
|
||||||
|
| ----------------- | ------------------- | --------------------- | --------- |
|
||||||
|
| `prod` | INFO | INFO | INFO |
|
||||||
|
| `prod-debug` | DEBUG | INFO | INFO |
|
||||||
|
| `prod-trace` | TRACE | DEBUG | INFO |
|
||||||
|
| `prod-trace-full` | TRACE | TRACE | INFO |
|
||||||
|
| `dev` | TRACE | DEBUG | INFO |
|
||||||
|
|
||||||
|
|
||||||
|
Manual set in production:
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Connect on the registry
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
To log-in and log-out from the registry:
|
||||||
|
```bash
|
||||||
|
export REGISTRY_ADDRESS=gitea.atria-soft.org
|
||||||
|
docker login -u <<YOUR_USER_NAME>> ${REGISTRY_ADDRESS}
|
||||||
|
docker logout ${REGISTRY_ADDRESS}
|
||||||
|
```
|
||||||
|
|
||||||
|
pull the root image of dockers
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull archlinux:base-devel
|
||||||
|
docker pull bellsoft/liberica-openjdk-alpine:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Create the version
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Execute in the local folder: (use ```dev``` for development and ```latest``` for production release)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export TAG_DOCKER=latest
|
||||||
|
export REGISTRY_ADDRESS=gitea.atria-soft.org
|
||||||
|
docker build -t ${REGISTRY_ADDRESS}/kangaroo-and-rabbit/karso:${TAG_DOCKER} .
|
||||||
|
docker push ${REGISTRY_ADDRESS}/kangaroo-and-rabbit/karso:${TAG_DOCKER}
|
||||||
|
```
|
||||||
|
|
||||||
|
56
env_dev/docker-compose.yaml
Normal file
56
env_dev/docker-compose.yaml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
services:
|
||||||
|
kar_db_service:
|
||||||
|
image: mysql:latest
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=base_db_password
|
||||||
|
volumes:
|
||||||
|
- ./data:/var/lib/mysql
|
||||||
|
mem_limit: 300m
|
||||||
|
ports:
|
||||||
|
- 3906:3306
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
# perform a 1 minute grace to let the DB to perform the initialization
|
||||||
|
start_period: 1m
|
||||||
|
start_interval: 1m
|
||||||
|
|
||||||
|
kar_mongodb_service:
|
||||||
|
image: mongo:latest
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: root
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: base_db_password
|
||||||
|
ports:
|
||||||
|
- 27017:27017
|
||||||
|
volumes:
|
||||||
|
- ./dataMongo:/data/db
|
||||||
|
|
||||||
|
kar_adminer_service:
|
||||||
|
image: adminer:latest
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
kar_db_service:
|
||||||
|
condition: service_healthy
|
||||||
|
links:
|
||||||
|
- kar_db_service:db
|
||||||
|
- kar_mongodb_service:dbm
|
||||||
|
ports:
|
||||||
|
- 4079:8080
|
||||||
|
mem_limit: 50m
|
||||||
|
|
||||||
|
mongo_express_service:
|
||||||
|
image: mongo-express
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 4077:8081
|
||||||
|
links:
|
||||||
|
- kar_mongodb_service:db
|
||||||
|
environment:
|
||||||
|
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||||
|
ME_CONFIG_MONGODB_ADMINPASSWORD: base_db_password
|
||||||
|
ME_CONFIG_MONGODB_URL: mongodb://root:base_db_password@db:27017/
|
||||||
|
ME_CONFIG_BASICAUTH: false
|
||||||
|
|
@ -4,23 +4,11 @@ import { Box } from '@chakra-ui/react';
|
|||||||
import { ChakraProvider } from '@chakra-ui/react';
|
import { ChakraProvider } from '@chakra-ui/react';
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import theme from '../src/theme';
|
import { ColorModeProvider } from '../src/components/ui/color-mode';
|
||||||
|
import { Toaster } from '../src/components/ui/toaster';
|
||||||
// .storybook/preview.js
|
import { systemTheme } from '../src/theme/theme';
|
||||||
export const parameters = {
|
|
||||||
options: {
|
|
||||||
storySort: {
|
|
||||||
order: ['StyleGuide', 'Components', 'Fields', 'App Layout'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actions: {},
|
|
||||||
layout: 'fullscreen',
|
|
||||||
backgrounds: { disable: true, grid: { disable: true } },
|
|
||||||
chakra: {
|
|
||||||
theme,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// .
|
||||||
const DocumentationWrapper = ({ children }) => {
|
const DocumentationWrapper = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<Box id="start-ui-storybook-wrapper" p="4" pb="8" flex="1">
|
<Box id="start-ui-storybook-wrapper" p="4" pb="8" flex="1">
|
||||||
@ -31,13 +19,16 @@ const DocumentationWrapper = ({ children }) => {
|
|||||||
|
|
||||||
export const decorators = [
|
export const decorators = [
|
||||||
(Story, context) => (
|
(Story, context) => (
|
||||||
<ChakraProvider theme={theme}>
|
<ColorModeProvider>
|
||||||
{/* Using MemoryRouter to avoid route clashing with Storybook */}
|
<ChakraProvider value={systemTheme}>
|
||||||
<MemoryRouter>
|
{/* Using MemoryRouter to avoid route clashing with Storybook */}
|
||||||
<DocumentationWrapper>
|
<MemoryRouter>
|
||||||
<Story {...context} />
|
<DocumentationWrapper>
|
||||||
</DocumentationWrapper>
|
<Story {...context} />
|
||||||
</MemoryRouter>
|
</DocumentationWrapper>
|
||||||
</ChakraProvider>
|
</MemoryRouter>
|
||||||
|
<Toaster />
|
||||||
|
</ChakraProvider>
|
||||||
|
</ColorModeProvider>
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -3,11 +3,7 @@ import type { KnipConfig } from 'knip';
|
|||||||
const config: KnipConfig = {
|
const config: KnipConfig = {
|
||||||
// Ignoring mostly shell binaries
|
// Ignoring mostly shell binaries
|
||||||
ignoreBinaries: ['export', 'sleep'],
|
ignoreBinaries: ['export', 'sleep'],
|
||||||
ignore: [
|
ignore: [],
|
||||||
// Related to tests
|
|
||||||
'tests/**',
|
|
||||||
'**.conf.js',
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { ReactNode, useEffect } from 'react';
|
import { ReactNode, useEffect } from 'react';
|
||||||
|
|
||||||
import { Flex, FlexProps } from '@chakra-ui/react';
|
import { Flex, FlexProps } from '@chakra-ui/react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
@ -113,18 +113,6 @@ export const TopBar = ({ title, children }: TopBarProps) => {
|
|||||||
drawerDisclose.onOpen();
|
drawerDisclose.onOpen();
|
||||||
};
|
};
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
// const onSignIn = (): void => {
|
|
||||||
// clearToken();
|
|
||||||
// requestSignIn();
|
|
||||||
// };
|
|
||||||
// const onSignUp = (): void => {
|
|
||||||
// clearToken();
|
|
||||||
// requestSignUp();
|
|
||||||
// };
|
|
||||||
// const onSignOut = (): void => {
|
|
||||||
// clearToken();
|
|
||||||
// requestSignOut();
|
|
||||||
// };
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
position="absolute"
|
position="absolute"
|
||||||
@ -189,7 +177,6 @@ export const TopBar = ({ title, children }: TopBarProps) => {
|
|||||||
<MenuRoot>
|
<MenuRoot>
|
||||||
<MenuTrigger asChild>
|
<MenuTrigger asChild>
|
||||||
<IconButton
|
<IconButton
|
||||||
//asChild
|
|
||||||
{...BUTTON_TOP_BAR_PROPERTY}
|
{...BUTTON_TOP_BAR_PROPERTY}
|
||||||
width={TOP_BAR_HEIGHT}
|
width={TOP_BAR_HEIGHT}
|
||||||
>
|
>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ReactNode, useState } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
import { LuMenu } from 'react-icons/lu';
|
import { LuMenu } from 'react-icons/lu';
|
||||||
|
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
import { RefObject, useEffect, useMemo, useRef, useState } from 'react';
|
import { RefObject, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
import {
|
import { Button, Flex, HStack, Input, Spinner, Tag } from '@chakra-ui/react';
|
||||||
Button,
|
|
||||||
Flex,
|
|
||||||
HStack,
|
|
||||||
Input,
|
|
||||||
Spinner,
|
|
||||||
Tag,
|
|
||||||
TagLabel,
|
|
||||||
} from '@chakra-ui/react';
|
|
||||||
import { MdEdit, MdKeyboardArrowDown, MdKeyboardArrowUp } from 'react-icons/md';
|
import { MdEdit, MdKeyboardArrowDown, MdKeyboardArrowUp } from 'react-icons/md';
|
||||||
|
|
||||||
import { SelectList, SelectListModel } from '@/components/select/SelectList';
|
import { SelectList, SelectListModel } from '@/components/select/SelectList';
|
||||||
|
@ -9,7 +9,7 @@ export interface Environment {
|
|||||||
replaceDataToRealServer?: boolean;
|
replaceDataToRealServer?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const serverSSOAddress = 'http://atria-soft.org';
|
const serverSSOAddress = 'https://atria-soft.org';
|
||||||
|
|
||||||
const environment_back_prod: Environment = {
|
const environment_back_prod: Environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
@ -31,5 +31,9 @@ const ErrorFallback = ({ error }: FallbackProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ErrorBoundary = ({ children }: { children: ReactNode }) => {
|
export const ErrorBoundary = ({ children }: { children: ReactNode }) => {
|
||||||
return <ReactErrorBoundary FallbackComponent={ErrorFallback} {...props} />;
|
return (
|
||||||
|
<ReactErrorBoundary FallbackComponent={ErrorFallback}>
|
||||||
|
{children}
|
||||||
|
</ReactErrorBoundary>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { createBrowserHistory } from 'history';
|
import { createBrowserHistory } from 'history';
|
||||||
import {
|
import {
|
||||||
unstable_HistoryRouter as HistoryRouter,
|
unstable_HistoryRouter as HistoryRouter,
|
||||||
|
Navigate,
|
||||||
Route,
|
Route,
|
||||||
Routes,
|
Routes,
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
@ -27,7 +28,8 @@ export const AppRoutes = () => {
|
|||||||
<Routes>
|
<Routes>
|
||||||
{isReadable ? (
|
{isReadable ? (
|
||||||
<>
|
<>
|
||||||
<Route path="/" element={<HomePage />} />
|
<Route path="/" element={<Navigate to="home" replace />} />
|
||||||
|
<Route path="/home/*" element={<HomePage />} />
|
||||||
{/* Connection page after SSO */}
|
{/* Connection page after SSO */}
|
||||||
<Route
|
<Route
|
||||||
path="signin/:applicationName/:applicationData/*"
|
path="signin/:applicationName/:applicationData/*"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user