feat(auth): Add Authorization Code Flow and new Keycloak recipes with new video tutorials (#4234)

Co-authored-by: Alireza <ar.sedghi@gmail.com>
This commit is contained in:
IbrahimandAlireza authored and GitHub committed 2024-07-09 14:33:37 -04:00
1 parent 998302eb85
commit aefa6d94df
81 files changed
+6525 -471

No files matched your search

@@ -0,0 +1,86 @@
worker_processes auto;
error_log /var/logs/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/logs/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
client_max_body_size 0;
# Handle /pacs requests and rewrite them to the correct dcm4chee-arc UI path
# This allows accessing the dcm4chee-arc UI through the /pacs URL
location /pacs {
rewrite ^/pacs(.*)$ /dcm4chee-arc/ui2$1 break;
proxy_pass http://arc:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
expires 0;
add_header Cache-Control private;
}
# Proxy all dcm4chee-arc requests
# This block handles all API requests and general dcm4chee-arc paths
location /dcm4chee-arc/ {
proxy_pass http://arc:8080/dcm4chee-arc/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /sw.js {
add_header Cache-Control "no-cache";
proxy_cache_bypass $http_pragma;
proxy_cache_revalidate on;
expires off;
access_log off;
}
location / {
root /var/www/html;
index index.html;
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-store, no-cache, must-revalidate";
add_header Cross-Origin-Opener-Policy 'same-origin' always;
add_header Cross-Origin-Embedder-Policy 'require-corp' always;
}
}
}
@@ -1,50 +1,45 @@
version: '3.5'
services:
ldap:
image: dcm4che/slapd-dcm4chee:2.4.44-15.0
image: dcm4che/slapd-dcm4chee:2.6.3-29.0
logging:
driver: json-file
options:
max-size: '10m'
max-size: "10m"
ports:
- '389:389'
env_file: ./dcm4che/docker-compose-dcm4che.env
- "389:389"
env_file: docker-compose.env
volumes:
- ./dcm4che/etc/localtime:/etc/localtime:ro
- ./dcm4che/etc/timezone:/etc/timezone:ro
- ./dcm4che/dcm4che-arc/ldap:/var/lib/ldap
- ./dcm4che/dcm4che-arc/slapd.d:/etc/ldap/slapd.d
networks:
- dcm4che_default
- ~/dcm4chee-arc/ldap:/var/lib/ldap
- ~/dcm4chee-arc/slapd.d:/etc/ldap/slapd.d
db:
image: dcm4che/postgres-dcm4chee:11.1-15
image: dcm4che/postgres-dcm4chee:14.5-29
logging:
driver: json-file
options:
max-size: '10m'
max-size: "10m"
ports:
- '5432:5432'
env_file: ./dcm4che/docker-compose-dcm4che.env
- "5432:5432"
env_file: docker-compose.env
volumes:
- ./dcm4che/etc/localtime:/etc/localtime:ro
- ./dcm4che/etc/timezone:/etc/timezone:ro
- ./dcm4che/dcm4che-arc/db:/var/lib/postgresql/data
networks:
- dcm4che_default
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ~/dcm4chee-arc/db:/var/lib/postgresql/data
arc:
image: dcm4che/dcm4chee-arc-psql:5.15.0
image: dcm4che/dcm4chee-arc-psql:5.29.0
logging:
driver: json-file
options:
max-size: '10m'
max-size: "10m"
ports:
- '8080:8080'
- '8443:8443'
- '9990:9990'
- '11112:11112'
- '2575:2575'
env_file: ./dcm4che/docker-compose-dcm4che.env
- "8080:8080"
- "8443:8443"
- "9990:9990"
- "9993:9993"
- "11112:11112"
- "2762:2762"
- "2575:2575"
- "12575:12575"
env_file: docker-compose.env
environment:
WILDFLY_CHOWN: /opt/wildfly/standalone /storage
WILDFLY_WAIT_FOR: ldap:389 db:5432
@@ -52,26 +47,27 @@ services:
- ldap
- db
volumes:
- ./dcm4che/etc/localtime:/etc/localtime:ro
- ./dcm4che/etc/timezone:/etc/timezone:ro
- ./dcm4che/dcm4che-arc/wildfly:/opt/wildfly/standalone
- ./dcm4che/dcm4che-arc/storage:/storage
networks:
- dcm4che_default
viewer:
container_name: ohif-viewer
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ~/dcm4chee-arc/wildfly:/opt/wildfly/standalone
- ~/dcm4chee-arc/storage:/storage
ohif_viewer:
build:
context: ../
dockerfile: Dockerfile
# Project root
context: ./../../../../
# Relative to context
dockerfile: ./platform/app/.recipes/Nginx-Dcm4chee/dockerfile
image: webapp:latest
container_name: ohif_dcm4chee
volumes:
# Nginx config
- ./config/nginx.conf:/etc/nginx/nginx.conf
# Logs
- ./logs/nginx:/var/logs/nginx
# Let's Encrypt
# - letsencrypt_certificates:/etc/letsencrypt
# - letsencrypt_challenges:/var/www/letsencrypt
ports:
- '80:80'
# depends_on:
# - orthanc
environment:
- NODE_ENV=production
- APP_CONFIG=config/local_dcm4chee
restart: always
networks:
- dcm4che_default
networks: dcm4che_default:
- '443:443' # SSL
- '80:80' # Web
restart: on-failure
@@ -0,0 +1,43 @@
# Stage 1: Build the application
FROM node:18.16.1-slim as builder
# Setup the working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install dependencies
# apt-get update is combined with apt-get install to avoid using outdated packages
RUN apt-get update && apt-get install -y build-essential python3
# Copy package.json and other dependency-related files first
# Assuming your package.json and yarn.lock or similar are located in the project root
COPY ./ /usr/src/app/
# Install node dependencies
RUN yarn config set workspaces-experimental true
RUN yarn install
# Copy the rest of the application code
# set QUICK_BUILD to true to make the build faster for dev
ENV APP_CONFIG=config/docker-nginx-dcm4chee.js
# Build the application
RUN yarn run build
# # Stage 2: Bundle the built application into a Docker container which runs NGINX using Alpine Linux
FROM nginx:alpine
# # Create directories for logs and html content if they don't already exist
RUN mkdir -p /var/log/nginx /var/www/html
# # Copy build output to serve static files
COPY --from=builder /usr/src/app/platform/app/dist /var/www/html
# # Expose HTTP and HTTPS ports
EXPOSE 80 443
# # Start NGINX
CMD ["nginx", "-g", "daemon off;"]
@@ -1,49 +0,0 @@
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 80 default_server;
server_name localhost;
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Allow-Headers' 'Authorization';
add_header 'Access-Control-Allow-Credentials' true;
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
add_header 'Access-Control-Allow-Headers' 'Authorization';
add_header 'Access-Control-Allow-Credentials' true;
}
proxy_pass http://orthanc:8042;
}
}
}