2023-04-06 11:46:54 +02:00
|
|
|
import { Application } from 'express';
|
|
|
|
import authorizationMiddleware from './authorization-middleware';
|
|
|
|
import { LogProvider } from '../logger';
|
2021-08-12 15:04:37 +02:00
|
|
|
|
2023-04-06 11:46:54 +02:00
|
|
|
function ossAuthHook(
|
|
|
|
app: Application,
|
|
|
|
getLogger: LogProvider,
|
|
|
|
baseUriPath: string,
|
|
|
|
): void {
|
2021-08-12 15:04:37 +02:00
|
|
|
app.use(
|
|
|
|
`${baseUriPath}/api`,
|
2023-04-06 11:46:54 +02:00
|
|
|
authorizationMiddleware(getLogger, baseUriPath),
|
|
|
|
);
|
|
|
|
app.use(
|
|
|
|
`${baseUriPath}/logout`,
|
|
|
|
authorizationMiddleware(getLogger, baseUriPath),
|
2021-08-12 15:04:37 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
export default ossAuthHook;
|