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

DMED-119 - Spike: direktes Einbinden der edu-sharing-Suchumgebung in den "Lern-Store" der SVS #4692

Draft
wants to merge 128 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
91de704
DMED-119 - adding some debug output
bergatco Jan 12, 2024
8dab0a7
DMED-119 - allow both cases for `ltiTools` endpoint
bergatco Jan 12, 2024
7a5eecf
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Mar 20, 2024
bd434a1
DMED-119 - revert changes (so far)
bergatco Mar 20, 2024
3555b00
DMED-119 - revert change of import order
bergatco Mar 20, 2024
c670949
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Mar 25, 2024
42a2c03
DMED-119 - initial setup of new `edu-sharing` service in NestJS
bergatco Mar 25, 2024
1fe320a
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Mar 27, 2024
f41b13c
DMED-119 - implement call to edu-sharing backend (WIP)
bergatco Mar 27, 2024
5236c93
BC-6988 Handle admin role when resolving school permissions (#4875)
dyedwiper Mar 27, 2024
de83a7e
BC-6994 - update Infra-tools to quay.io (#4878)
mamutmk5 Mar 27, 2024
56be147
BC-6820 - Tldraw file deletion cronjob (#4860)
davwas Mar 28, 2024
a41f59f
BC-6794 Add check if column board has drawing as its child (#4850)
blazejpass Mar 28, 2024
617f260
N21-1848 fixes matching of migration wizard (#4883)
IgorCapCoder Mar 28, 2024
73261db
BC-7009 changed default scan_file queue to scan_file_v2 (#4884)
Loki-Afro Apr 2, 2024
3054c5f
N21-1836 extends the ctl data model (#4876)
arnegns Apr 2, 2024
a43388a
BC-6461 refactor tldraw redis logic (#4879)
wiaderwek Apr 2, 2024
2b1ce42
BC-7017 - add school specific permissions to user entity (#4887)
SevenWaysDP Apr 3, 2024
6eedba6
BC-7037 increased init job memory to 2gb (#4892)
Loki-Afro Apr 4, 2024
b90b771
BC-7028 add description possibility to ALLOWED_API_KEYS env var (#4889)
Loki-Afro Apr 4, 2024
318e613
N21-1843 Resolve dependency cycle with leanroom (#4877)
MarvinOehlerkingCap Apr 4, 2024
e20e48b
BC-5334 - migrate deletion of systems from schools endpoint to v3 (#4…
dyedwiper Apr 5, 2024
a42c876
N21-1849 clean up import users (#4894)
MBergCap Apr 5, 2024
23eb1ab
BC-7063 KNL Refactor - deletion threshold and database indexes (#4896)
WojciechGrancow Apr 8, 2024
71cbc72
EW-620 account module refactoring (#4869)
MajedAlaitwniCap Apr 8, 2024
be746f8
EW-797 extended the CC export of column titles (#4895)
Fshmit Apr 8, 2024
5b46cf7
BC-6460 Remove redis-node package (#4890)
blazejpass Apr 8, 2024
ec5c7e6
N21 1835 show migrated user bug fix (#4899)
mrikallab Apr 8, 2024
5371fb7
BC-5374 - add endpoint /v3/courses/:id/userPermissions (#4891)
EzzatOmar Apr 8, 2024
97d17ca
N21-1774 create synced course (#4830)
IgorCapCoder Apr 8, 2024
ee4977f
N21-1833 load media board (#4897)
MarvinOehlerkingCap Apr 8, 2024
67bb1af
BC-6315 calendar service - knl (#4885)
MichalNers Apr 8, 2024
247d0d5
BC-7063 - add default value for ADMIN_API__ MODIFICATION_THRESHOLD in…
WojciechGrancow Apr 9, 2024
b17ef56
BC-5616 - remove delete-task v1 endpoint (#4841)
wolfganggreschus Apr 10, 2024
95a7128
BC-6885 - remove standalone mongodb package (#4905)
wolfganggreschus Apr 10, 2024
d3abae1
BC-7100 add env vars to admin-api-configmap (#4908)
Loki-Afro Apr 10, 2024
1f3116d
BC-7120 enhance logging (#4913)
Loki-Afro Apr 10, 2024
634d4aa
BC-6413 - moin.schule synchronization CronJob (#4859)
bn-pass Apr 10, 2024
93a6fdf
EW-800: Add export of card title. (#4909)
mkreuzkam-cap Apr 11, 2024
d112cc0
BC-7066 KNL Refactor - Error Handling not suppose to give Bad Gateway…
WojciechGrancow Apr 11, 2024
0f1ef0b
BC-6420 - unsynced users deletion (#4868)
bn-pass Apr 11, 2024
506c571
N21-1821 migration wizard load class assignment (#4922)
MBergCap Apr 12, 2024
141dc54
BC-7117 KNL Refactor - RocketChat (#4911)
WojciechGrancow Apr 15, 2024
66f02e8
EW-798 expanded cc export of rich text elements of column board (#4923)
Fshmit Apr 15, 2024
c9846a8
PSW-28 Fix potential XSS exploit on WOPI API (#4925)
dyedwiper Apr 15, 2024
7a4fbdc
N21-1337 removes deprecated ctl versioning (#4927)
arnegns Apr 15, 2024
bafb527
N21-1859 Prevent login and migration for multipe users (#4921)
mrikallab Apr 16, 2024
72dfc81
N21-1886 course date sync fix (#4933)
IgorCapCoder Apr 17, 2024
d08a772
BC-6654 - Update mongo to v5 (#4916)
davwas Apr 17, 2024
f05e18b
Update sanitize-html 2.12.1 (#4938)
wolfganggreschus Apr 17, 2024
0bc0599
N21-1830 media available line (#4917)
arnegns Apr 17, 2024
5b06644
BC-7036 - move course permissions path (#4931)
EzzatOmar Apr 17, 2024
aaef1b2
EW-799 Common Cartridge Export of Column Board Link Elements (#4932)
psachmann Apr 18, 2024
fcdca1c
EW-771 Common Cartridge 1.1.0 Web Link Import (#4915)
psachmann Apr 19, 2024
4da26d9
N21-1858 prevent migration to same login system (#4934)
MBergCap Apr 19, 2024
5b63b07
N21-1803 Refactorings from Code Review 6 (#4944)
MarvinOehlerkingCap Apr 19, 2024
1f17aba
N21 1823 add other group users feature flag (#4930)
mrikallab Apr 19, 2024
b1a0751
BC-5903 Refactor Unit test for Dual Authorization Methods (JWT and X-…
WojciechGrancow Apr 19, 2024
cb99380
EW-828: Add control option for column boards. (#4936)
mkreuzkam-cap Apr 19, 2024
cb5b911
N21-1783 Remove unused lti message type (#4946)
MarvinOehlerkingCap Apr 19, 2024
9bb8472
N21-1785 throw loggable in wizard when migration is not active (#4948)
IgorCapCoder Apr 22, 2024
87ac1f0
BC-6770 - Create a list board (#4914)
uidp Apr 22, 2024
f842cbb
N21-1828 add migration wizard permissions to admin role (#4935)
IgorCapCoder Apr 22, 2024
8f49889
BC-7185 - fix unexpected EXIT_ON_ERROR values (#4949)
bn-pass Apr 22, 2024
3bb0c77
BC-6781 - Add collaborative text editor element to api (#4906)
bischofmax Apr 22, 2024
0e7cc62
BC-7082 Add domain error handler (#4904)
CeEv Apr 22, 2024
c9e3e8b
BC-7021 Remove duplicated code in me module (#4941)
dyedwiper Apr 23, 2024
ee9d07e
N21-1631 change ctl error handling (#4947)
MBergCap Apr 24, 2024
c78fea4
BC-7179 - add missing indexes (#4952)
bn-pass Apr 24, 2024
083d531
BC-7197 Change Index declaration method (#4957)
blazejpass Apr 24, 2024
da554f7
Bc 7197 fix migration (#4958)
blazejpass Apr 25, 2024
c21d2dc
EW-770 Common Cartridge import of web content into column board 1.1.…
Fshmit Apr 25, 2024
88d8e0d
BC-7167 - add missing ConfigMap and concurrencyPolicy (#4959)
bn-pass Apr 25, 2024
5dd38d1
BC-6757 - Delete etherpad (#4951)
bischofmax Apr 25, 2024
f793ab2
BC-7197 remove type index (#4960)
wiaderwek Apr 25, 2024
9c7e532
BC-6470 - Fix s3 client log message (#4965)
bischofmax Apr 26, 2024
37a6dd2
BC-5661 - refactor RabbitMQ configuration (#4963)
SevenWaysDP Apr 26, 2024
f0b03ab
N21-1888- check email in provisioning (#4955)
IgorCapCoder Apr 26, 2024
6dc93b8
BC-5268 move alert api to nest (#4929)
wiaderwek Apr 29, 2024
cea078e
BC-6965 - Fix videoconference guest label bug (#4943)
davwas Apr 30, 2024
ad6cdf2
BC-7251 - Remove license exception (#4972)
bischofmax Apr 30, 2024
30e790b
BC-6807 - Copy collaborative text editor (#4961)
bischofmax Apr 30, 2024
37357c0
N21-1880 provision user licenses when provision users (#4962)
arnegns Apr 30, 2024
3e37cf2
BC-7211 Fix school permission resolution in user entity (#4956)
dyedwiper Apr 30, 2024
1c56d65
BC-6850 socket api implementation (#4924)
Metauriel Apr 30, 2024
0fe1b43
EW-857 Fixing password recovery feature (#4974)
psachmann May 2, 2024
e6d8b69
N21-1881 media licensing logic (#4967)
IgorCapCoder May 2, 2024
7265c7b
N21-1862 add seed data (#4966)
MBergCap May 3, 2024
77be63d
N21-1887 Rollback user from a user login migration (#4978)
MarvinOehlerkingCap May 3, 2024
d411a25
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco May 6, 2024
ded8c44
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco May 16, 2024
972a60e
DMED-119 - add working example of `nest-auth-server`
bergatco May 16, 2024
1dac1ea
DMED-119 - rename `EDU_SHARING__DOMAIN` to `EDU_SHARING__API_URL`
bergatco May 16, 2024
431683b
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco May 23, 2024
288480b
DMED-119 - make `EDU_SHARING__API_URL` available via `envConfigModule`
bergatco May 24, 2024
d84bfa3
DMED-119 - fix some config issues with `EDU_SHARING__API_URL`
bergatco May 28, 2024
cc3c2f8
DMED-119 - update Kubernetes deployment for EduSharing API and add In…
bergatco May 28, 2024
f3df998
DMED-119 - Add Kubernetes deployment for EduSharingService
bergatco May 28, 2024
5fb2a85
DMED-119 - update API EduSharing deployment configuration
bergatco May 28, 2024
2b6ee0a
DMED-119 - add some debug outputs
bergatco May 28, 2024
b1bb1c0
DMED-119 - add more debug outputs
bergatco May 28, 2024
204ffa6
DMED-119 - add public and private key conversion
bergatco May 29, 2024
c9115b6
DMED-119 - add new line at the end of public and private key string
bergatco May 29, 2024
c274742
DMED-119 - move private and public key to files
bergatco May 29, 2024
5e81cda
DMED-119 - read private and public key from file
bergatco May 29, 2024
b1834ad
DMED-119 - refactor EduSharingService to read private and public keys…
bergatco May 29, 2024
7370403
DMED-119 - remove private and public keys from `EduSharingConfig`
bergatco May 29, 2024
315664d
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco May 29, 2024
ceadbf4
DMED-119 - update default schema and development config
bergatco May 29, 2024
929c3d9
DMED-119 - update console log message in edu-sharing.app.ts
bergatco May 29, 2024
6ad07f7
DMED-119 - use `@CurrentUser` when requesting new ticket
bergatco May 29, 2024
f9e811f
DMED-119 - minor refactoring to fix small linter issue
bergatco May 29, 2024
2c8096b
DMED-119 - update `EduSharingController`, `EduSharingUC ` and `EduSha…
bergatco May 30, 2024
54019f1
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco May 30, 2024
c4c8d81
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Jul 1, 2024
9c81e24
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Jul 1, 2024
29a9c85
DMED-119 - remove redundant code and update naming of edu-sharing tasks
bergatco Jul 1, 2024
0700dd0
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Jul 2, 2024
96a6a85
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Jul 2, 2024
4579719
DMED-119 - remove authentication from `/register` endpoint
bergatco Jul 3, 2024
2d0b218
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Jul 8, 2024
2c831f4
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Aug 26, 2024
4ce0d0d
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Sep 4, 2024
78720bc
DMED-119 - update authentication module import in edu-sharing controller
bergatco Sep 4, 2024
3f2faad
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Sep 9, 2024
3aad7c7
DMED-119 - add EDU_SHARING configuration variables to admin-api-serve…
bergatco Sep 10, 2024
fe3c6fe
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Sep 16, 2024
a414ded
Merge branch 'main' into DMED-119-integration-of-search-environment
bergatco Sep 23, 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
19 changes: 19 additions & 0 deletions ansible/roles/schulcloud-server-core/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
tags:
- service

- name: Edu Sharing Service
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: api-edu-sharing-svc.yml.j2

- name: FwuLearningContentsService
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
Expand Down Expand Up @@ -193,6 +199,19 @@
tags:
- ingress

- name: Edu Sharing Deployment
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: api-edu-sharing-deployment.yml.j2

- name: Edu Sharing Ingress
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: api-edu-sharing-ingress.yml.j2
apply: yes

- name: FwuLearningContentsDeployment
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ data:
IDENTITY_MANAGEMENT__EXTERNAL_URI: "{{ IDENTITY_MANAGEMENT__EXTERNAL_URI }}"
IDENTITY_MANAGEMENT__TENANT: "{{ IDENTITY_MANAGEMENT__TENANT }}"
IDENTITY_MANAGEMENT__CLIENTID: "{{ IDENTITY_MANAGEMENT__CLIENTID }}"
EDU_SHARING__APP_ID: "{{ EDU_SHARING__APP_ID }}"
EDU_SHARING__API_URL: "{{ EDU_SHARING__API_URL }}"
EDU_SHARING_CONNECT_SRC_URLS: "{{ EDU_SHARING_CONNECT_SRC_URLS }}"
EDU_SHARING_IMG_SRC_URLS: "{{ EDU_SHARING_IMG_SRC_URLS }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-edu-sharing-deployment
namespace: {{ NAMESPACE }}
labels:
app: api-edu-sharing
app.kubernetes.io/part-of: schulcloud-verbund
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }}
app.kubernetes.io/name: api-edu-sharing
app.kubernetes.io/component: edu-sharing
app.kubernetes.io/managed-by: ansible
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }}
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }}
spec:
replicas: {{ API_EDU_SHARING_REPLICAS|default("1", true) }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
#maxUnavailable: 1
revisionHistoryLimit: 4
paused: false
selector:
matchLabels:
app: api-edu-sharing
template:
metadata:
labels:
app: api-edu-sharing
app.kubernetes.io/part-of: schulcloud-verbund
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }}
app.kubernetes.io/name: api-edu-sharing
app.kubernetes.io/component: edu-sharing
app.kubernetes.io/managed-by: ansible
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }}
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }}
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
containers:
- name: api-edu-sharing
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }}
imagePullPolicy: IfNotPresent
ports:
- containerPort: 4450
name: api-edu-sharing
protocol: TCP
envFrom:
- configMapRef:
name: api-configmap
- secretRef:
name: api-secret
command: ['npm', 'run', 'nest:start:edu-sharing:prod']
readinessProbe:
httpGet:
path: api/v3/docs
port: 4450
timeoutSeconds: 4
failureThreshold: 3
periodSeconds: 5
# liveless if unsatisfactory reply
livenessProbe:
httpGet:
path: api/v3/docs
port: 4450
timeoutSeconds: 4
failureThreshold: 3
periodSeconds: 15
startupProbe:
httpGet:
path: api/v3/docs
port: 4450
timeoutSeconds: 4
failureThreshold: 36
periodSeconds: 5
resources:
limits:
cpu: {{ API_EDU_SHARING_CPU_LIMITS|default("2000m", true) }}
memory: {{ API_EDU_SHARING_MEMORY_LIMITS|default("500Mi", true) }}
requests:
cpu: {{ API_EDU_SHARING_CPU_REQUESTS|default("100m", true) }}
memory: {{ API_EDU_SHARING_MEMORY_REQUESTS|default("50Mi", true) }}
{% if AFFINITY_ENABLE is defined and AFFINITY_ENABLE|bool %}
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 9
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/part-of
operator: In
values:
- schulcloud-verbund
topologyKey: "kubernetes.io/hostname"
namespaceSelector: {}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
{% if ANIT_AFFINITY_NODEPOOL_ENABLE is defined and ANIT_AFFINITY_NODEPOOL_ENABLE|bool %}
- weight: 10
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- api-edu-sharing
topologyKey: {{ ANIT_AFFINITY_NODEPOOL_TOPOLOGY_KEY }}
{% endif %}
- weight: 20
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- api-edu-sharing
topologyKey: "topology.kubernetes.io/zone"
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ NAMESPACE }}-api-edu-sharing-ingress
namespace: {{ NAMESPACE }}
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "{{ TLS_ENABLED|default("false") }}"
nginx.ingress.kubernetes.io/proxy-body-size: "{{ INGRESS_MAX_BODY_SIZE|default("2560") }}m"
nginx.org/client-max-body-size: "{{ INGRESS_MAX_BODY_SIZE|default("2560") }}m"
# The following properties added with BC-3606.
# The header size of the request is too big. For e.g. state and the permanent growing jwt.
# Nginx throws away the Location header, resulting in the 502 Bad Gateway.
nginx.ingress.kubernetes.io/client-header-buffer-size: 100k
nginx.ingress.kubernetes.io/http2-max-header-size: 96k
nginx.ingress.kubernetes.io/large-client-header-buffers: 4 100k
nginx.ingress.kubernetes.io/proxy-buffer-size: 96k
nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
{% if CLUSTER_ISSUER is defined %}
cert-manager.io/cluster-issuer: {{ CLUSTER_ISSUER }}
{% endif %}

spec:
ingressClassName: {{ INGRESS_CLASS }}
{% if CLUSTER_ISSUER is defined or (TLS_ENABLED is defined and TLS_ENABLED|bool) %}
tls:
- hosts:
- {{ DOMAIN }}
{% if CLUSTER_ISSUER is defined %}
secretName: {{ DOMAIN }}-tls
{% endif %}
{% endif %}
rules:
- host: {{ DOMAIN }}
http:
paths:
- path: /api/v3/edu-sharing/
backend:
service:
name: api-edu-sharing-svc
port:
number: {{ PORT_EDU_SHARING_SERVICE }}
pathType: Prefix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: api-edu-sharing-svc
namespace: {{ NAMESPACE }}
labels:
app: api-edu-sharing
spec:
type: ClusterIP
ports:
- port: {{ PORT_EDU_SHARING_SERVICE }}
targetPort: 4450
protocol: TCP
name: api-edu-sharing
selector:
app: api-edu-sharing
55 changes: 55 additions & 0 deletions apps/server/src/apps/edu-sharing.app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* istanbul ignore file */
/* eslint-disable no-console */
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import express from 'express';

// register source-map-support for debugging
import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { EduSharingApiModule } from '@modules/edu-sharing/edu-sharing-api.module';
import { API_VERSION_PATH } from '@modules/edu-sharing/edu-sharing.const';

Check warning on line 12 in apps/server/src/apps/edu-sharing.app.ts

View workflow job for this annotation

GitHub Actions / nest_lint

'@modules/edu-sharing/edu-sharing.const' import is restricted from being used by a pattern. Do not deep import from a module
import { SwaggerDocumentOptions } from '@nestjs/swagger';
import { LegacyLogger } from '@src/core/logger';
import { enableOpenApiDocs } from '@src/shared/controller/swagger';

async function bootstrap() {
sourceMapInstall();

// create the NestJS application on a seperate express instance
const nestExpress = express();

const nestExpressAdapter = new ExpressAdapter(nestExpress);
const nestApp = await NestFactory.create(EduSharingApiModule, nestExpressAdapter);

// WinstonLogger
nestApp.useLogger(await nestApp.resolve(LegacyLogger));

// customize nest app settings
nestApp.enableCors({ exposedHeaders: ['Content-Disposition'] });

const options: SwaggerDocumentOptions = {
operationIdFactory: (_controllerKey: string, methodKey: string) => methodKey,
};
enableOpenApiDocs(nestApp, 'docs', options);

await nestApp.init();

// mount instances
const rootExpress = express();

const port = 4450;
const basePath = API_VERSION_PATH;

// exposed alias mounts
rootExpress.use(basePath, nestExpress);
rootExpress.listen(port);

console.log('#################################');
console.log(`### Start edu-sharing Server ###`);
console.log(`### Port: ${port} ###`);
console.log(`### Base path: ${basePath} ###`);
console.log('#################################');
}
void bootstrap();
6 changes: 6 additions & 0 deletions apps/server/src/modules/edu-sharing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Module Description - edu-sharing

## Summary

This module is a stand alone service.
The service handles the retrieval of a valid "ticket" (session) from the respective edu-sharing back end.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsString } from 'class-validator';

export class TicketParams {
@IsString()
@ApiProperty({
description: 'The ticket to be evaluated.',
required: true,
nullable: false,
})
ticket!: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './edu-sharing.params';
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { CurrentUser, ICurrentUser, JwtAuthentication } from '@infra/auth-guard';
import {
Controller,
ForbiddenException,
Get,
InternalServerErrorException,
NotAcceptableException,
NotFoundException,
Param,
} from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { LoginDto } from '../dto';
import { EduSharingUC } from '../uc';
import { TicketParams } from './dto';

@ApiTags('edu-sharing')
@Controller('edu-sharing')
export class EduSharingController {
constructor(private readonly eduSharingUC: EduSharingUC) {}

@JwtAuthentication()
@ApiOperation({
summary: 'Fetches the edu-sharing ticket for a given user name.',
})
@ApiResponse({ status: 200, type: String })
@ApiResponse({ status: 206, type: String })
@ApiResponse({ status: 403, type: ForbiddenException })
@ApiResponse({ status: 404, type: NotFoundException })
@ApiResponse({ status: 406, type: NotAcceptableException })
@ApiResponse({ status: 500, type: InternalServerErrorException })
@Get('/')
async getTicketForUser(@CurrentUser() currentUser: ICurrentUser): Promise<string | undefined> {
const ticket = await this.eduSharingUC.getTicketForUser(currentUser.userId);

return ticket;
}

@JwtAuthentication()
@ApiOperation({
summary:
'Gets detailed information about a ticket. Will throw an exception if the given ticket is not valid anymore.',
})
@ApiResponse({ status: 200, type: String })
@ApiResponse({ status: 206, type: String })
@ApiResponse({ status: 403, type: ForbiddenException })
@ApiResponse({ status: 404, type: NotFoundException })
@ApiResponse({ status: 406, type: NotAcceptableException })
@ApiResponse({ status: 500, type: InternalServerErrorException })
@Get('/validate/:ticket')
async getTicketAuthenticationInfo(@Param() params: TicketParams): Promise<LoginDto> {
const result = await this.eduSharingUC.getTicketAuthenticationInfo(params);

return result;
}

@ApiOperation({
summary: 'Returns the required XML for registering the service against an edu-sharing repository.',
})
@ApiResponse({ status: 200, type: String })
@ApiResponse({ status: 206, type: String })
@ApiResponse({ status: 403, type: ForbiddenException })
@ApiResponse({ status: 404, type: NotFoundException })
@ApiResponse({ status: 406, type: NotAcceptableException })
@ApiResponse({ status: 500, type: InternalServerErrorException })
@Get('/register')
getEduAppXMLData(): string {
const xmlData = this.eduSharingUC.getEduAppXMLData();

return xmlData;
}
}
1 change: 1 addition & 0 deletions apps/server/src/modules/edu-sharing/controller/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './edu-sharing.controller';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface AuthenticationTokenDto {
ticket?: string;
userId?: string;
}
Loading
Loading