diff --git a/express-api/package.json b/express-api/package.json index ef530b139..ff3f16038 100644 --- a/express-api/package.json +++ b/express-api/package.json @@ -20,7 +20,7 @@ "license": "ISC", "dependencies": { "@bcgov/citz-imb-kc-css-api": "https://github.com/bcgov/citz-imb-kc-css-api/releases/download/v1.4.0/bcgov-citz-imb-kc-css-api-1.4.0.tgz", - "@bcgov/citz-imb-sso-express": "1.0.3-beta3", + "@bcgov/citz-imb-sso-js-core": "1.0.3", "compression": "1.8.0", "cookie-parser": "1.4.7", "cors": "2.8.5", diff --git a/express-api/src/controllers/users/usersController.ts b/express-api/src/controllers/users/usersController.ts index c6f7f512d..7d142eabe 100644 --- a/express-api/src/controllers/users/usersController.ts +++ b/express-api/src/controllers/users/usersController.ts @@ -1,6 +1,6 @@ import userServices from '@/services/users/usersServices'; import { Request, Response } from 'express'; -import { SSOUser } from '@bcgov/citz-imb-sso-express'; +import { SSOUser } from '@/middleware/keycloak/ssoUser'; import { UserFiltering, UserFilteringSchema } from '@/controllers/users/usersSchema'; import { z } from 'zod'; import notificationServices from '@/services/notifications/notificationServices'; diff --git a/express-api/src/express.ts b/express-api/src/express.ts index 55a7b4c9f..e7772dbf5 100644 --- a/express-api/src/express.ts +++ b/express-api/src/express.ts @@ -4,11 +4,11 @@ import cookieParser from 'cookie-parser'; import compression from 'compression'; import cors from 'cors'; import rateLimit from 'express-rate-limit'; -import { protectedRoute, sso } from '@bcgov/citz-imb-sso-express'; +import protectedRoute from '@/middleware/keycloak/protectedRoute'; +import authRouter from '@/middleware/keycloak/authRouter'; import router from '@/routes'; import middleware from '@/middleware'; import constants from '@/constants'; -import { SSO_OPTIONS } from '@/middleware/keycloak/keycloakOptions'; import swaggerUi from 'swagger-ui-express'; import swaggerJSDoc from 'swagger-jsdoc'; import errorHandler from '@/middleware/errorHandler'; @@ -60,8 +60,8 @@ const { headerHandler, morganMiddleware } = middleware; // Logging Middleware app.use(morganMiddleware); -// SSO initialization -sso(app, SSO_OPTIONS); +// SSO authentication routes (consumed by the @bcgov/citz-imb-sso-react package) +app.use('/auth', authRouter); // Nunjucks configuration const nj = nunjucks.configure('src/notificationTemplates', { diff --git a/express-api/src/middleware/keycloak/authConfig.ts b/express-api/src/middleware/keycloak/authConfig.ts new file mode 100644 index 000000000..9b698b123 --- /dev/null +++ b/express-api/src/middleware/keycloak/authConfig.ts @@ -0,0 +1,35 @@ +import { AUTH_URLS } from '@bcgov/citz-imb-sso-js-core'; + +const { + FRONTEND_URL = '', + BACKEND_URL = '', + SSO_CLIENT_ID = '', + SSO_CLIENT_SECRET = '', + SSO_ENVIRONMENT = 'dev', +} = process.env; + +export type SSOEnvironment = 'dev' | 'test' | 'prod'; + +export const ssoClient = { + clientID: SSO_CLIENT_ID, + clientSecret: SSO_CLIENT_SECRET, + ssoEnvironment: SSO_ENVIRONMENT as SSOEnvironment, + ssoRealm: 'standard', + ssoProtocol: 'openid-connect' as const, +}; + +export const FRONTEND_URL_CONFIG = FRONTEND_URL; +export const BACKEND_URL_CONFIG = BACKEND_URL; + +export const COOKIE_DOMAIN = FRONTEND_URL.includes('localhost') ? 'localhost' : '.gov.bc.ca'; + +export const refreshCookieOptions = { + httpOnly: true, + secure: true, + sameSite: 'none' as const, + domain: COOKIE_DOMAIN, +}; + +export const AUTH_SERVER_URL = + process.env.SSO_AUTH_SERVER_URL?.trim() ?? + `${AUTH_URLS[ssoClient.ssoEnvironment]}/realms/${ssoClient.ssoRealm}/protocol/${ssoClient.ssoProtocol}`; diff --git a/express-api/src/middleware/keycloak/authRouter.ts b/express-api/src/middleware/keycloak/authRouter.ts new file mode 100644 index 000000000..dff2f4713 --- /dev/null +++ b/express-api/src/middleware/keycloak/authRouter.ts @@ -0,0 +1,15 @@ +import { Router } from 'express'; +import { login, loginCallback, logout, logoutCallback, token } from './controllers'; + +/** + * Routes required by the @bcgov/citz-imb-sso-react frontend package. + */ +const authRouter = Router(); + +authRouter.get('/login', login); +authRouter.get('/login/callback', loginCallback); +authRouter.get('/logout', logout); +authRouter.get('/logout/callback', logoutCallback); +authRouter.post('/token', token); + +export default authRouter; diff --git a/express-api/src/middleware/keycloak/controllers/index.ts b/express-api/src/middleware/keycloak/controllers/index.ts new file mode 100644 index 000000000..d999a5cea --- /dev/null +++ b/express-api/src/middleware/keycloak/controllers/index.ts @@ -0,0 +1,5 @@ +export * from './login'; +export * from './loginCallback'; +export * from './logout'; +export * from './logoutCallback'; +export * from './token'; diff --git a/express-api/src/middleware/keycloak/controllers/login.ts b/express-api/src/middleware/keycloak/controllers/login.ts new file mode 100644 index 000000000..0f903e41b --- /dev/null +++ b/express-api/src/middleware/keycloak/controllers/login.ts @@ -0,0 +1,39 @@ +import { RequestHandler } from 'express'; +import { getLoginURL } from '@bcgov/citz-imb-sso-js-core'; +import type { SSOEnvironment, SSOIdentityProvider, SSOProtocol } from '@bcgov/citz-imb-sso-js-core'; +import logger from '@/utilities/winstonLogger'; +import { BACKEND_URL_CONFIG, COOKIE_DOMAIN, ssoClient } from '../authConfig'; + +const loginCallbackURI = () => `${BACKEND_URL_CONFIG}/auth/login/callback`; + +/** + * GET /auth/login + * Initiates the Keycloak login flow. Stashes the desired post-login redirect + * in a cookie (read again by /auth/login/callback) and redirects the browser + * to the Keycloak authorization endpoint. + */ +export const login: RequestHandler = async (req, res) => { + try { + const { idp, post_login_redirect_url } = req.query; + const redirectURL = getLoginURL({ + idpHint: idp ? (String(idp) as SSOIdentityProvider) : undefined, + clientID: ssoClient.clientID, + redirectURI: loginCallbackURI(), + ssoEnvironment: ssoClient.ssoEnvironment as SSOEnvironment, + ssoRealm: ssoClient.ssoRealm, + ssoProtocol: ssoClient.ssoProtocol as SSOProtocol, + }); + if (post_login_redirect_url) { + res.cookie('post_login_redirect_url', String(post_login_redirect_url), { + domain: COOKIE_DOMAIN, + }); + } + return res.redirect(redirectURL); + } catch (error) { + logger.error('SSO login controller error:', error); + if (error instanceof Error) { + return res.status(500).json({ success: false, error: error.message }); + } + return res.status(500).json({ success: false, error }); + } +}; diff --git a/express-api/src/middleware/keycloak/controllers/loginCallback.ts b/express-api/src/middleware/keycloak/controllers/loginCallback.ts new file mode 100644 index 000000000..5af3086ee --- /dev/null +++ b/express-api/src/middleware/keycloak/controllers/loginCallback.ts @@ -0,0 +1,50 @@ +import { RequestHandler } from 'express'; +import { decodeJWT, getTokens, normalizeUser } from '@bcgov/citz-imb-sso-js-core'; +import type { SSOEnvironment, SSOProtocol } from '@bcgov/citz-imb-sso-js-core'; +import logger from '@/utilities/winstonLogger'; +import { SSO_OPTIONS } from '@/middleware/keycloak/keycloakOptions'; +import { + BACKEND_URL_CONFIG, + FRONTEND_URL_CONFIG, + refreshCookieOptions, + ssoClient, +} from '../authConfig'; + +const loginCallbackURI = () => `${BACKEND_URL_CONFIG}/auth/login/callback`; + +/** + * GET /auth/login/callback + * Exchanges the authorization code for tokens, stores the refresh token in an + * httpOnly cookie and bounces the browser back to the frontend, carrying the + * refresh_expires_in and the original post-login redirect target. + */ +export const loginCallback: RequestHandler = async (req, res) => { + try { + const { code } = req.query; + if (!code) { + return res.status(400).send('Missing authorization code.'); + } + const { access_token, refresh_token, refresh_expires_in } = await getTokens({ + code: String(code), + clientID: ssoClient.clientID, + clientSecret: ssoClient.clientSecret, + redirectURI: loginCallbackURI(), + ssoEnvironment: ssoClient.ssoEnvironment as SSOEnvironment, + ssoRealm: ssoClient.ssoRealm, + ssoProtocol: ssoClient.ssoProtocol as SSOProtocol, + }); + const { post_login_redirect_url } = req.cookies; + const redirectURL = `${FRONTEND_URL_CONFIG}?refresh_expires_in=${refresh_expires_in}&post_login_redirect_url=${post_login_redirect_url}`; + res.cookie('refresh_token', refresh_token, refreshCookieOptions).redirect(redirectURL); + const normalizedUser = normalizeUser(decodeJWT(access_token)); + if (normalizedUser) { + await SSO_OPTIONS.afterUserLogin(normalizedUser); + } + } catch (error) { + logger.error('SSO loginCallback controller error:', error); + if (error instanceof Error) { + return res.status(500).json({ success: false, error: error.message }); + } + return res.status(500).json({ success: false, error }); + } +}; diff --git a/express-api/src/middleware/keycloak/controllers/logout.ts b/express-api/src/middleware/keycloak/controllers/logout.ts new file mode 100644 index 000000000..c508e38a8 --- /dev/null +++ b/express-api/src/middleware/keycloak/controllers/logout.ts @@ -0,0 +1,49 @@ +import { RequestHandler } from 'express'; +import { decodeJWT, getLogoutURL, normalizeUser } from '@bcgov/citz-imb-sso-js-core'; +import type { SSOEnvironment, SSOProtocol } from '@bcgov/citz-imb-sso-js-core'; +import logger from '@/utilities/winstonLogger'; +import { SSO_OPTIONS } from '@/middleware/keycloak/keycloakOptions'; +import { + BACKEND_URL_CONFIG, + FRONTEND_URL_CONFIG, + refreshCookieOptions, + ssoClient, +} from '../authConfig'; + +/** + * GET /auth/logout + * Redirects the browser through Keycloak (and SiteMinder) logout, clearing the + * refresh_token cookie either here or on the logout callback. + */ +export const logout: RequestHandler = async (req, res) => { + try { + const { id_token } = req.query; + if (!id_token || id_token === 'undefined') { + return res + .cookie('refresh_token', '', { ...refreshCookieOptions, maxAge: 0 }) + .redirect(FRONTEND_URL_CONFIG ?? ''); + } + const redirectURL = getLogoutURL({ + idToken: String(id_token), + postLogoutRedirectURI: `${BACKEND_URL_CONFIG}/auth/logout/callback`, + ssoEnvironment: ssoClient.ssoEnvironment as SSOEnvironment, + ssoRealm: ssoClient.ssoRealm, + ssoProtocol: ssoClient.ssoProtocol as SSOProtocol, + }); + res.redirect(redirectURL); + try { + const normalizedUser = normalizeUser(decodeJWT(String(id_token))); + if (normalizedUser) { + SSO_OPTIONS.afterUserLogout(normalizedUser); + } + } catch { + // Malformed id_token; the logout redirect still proceeds. + } + } catch (error) { + logger.error('SSO logout controller error:', error); + if (error instanceof Error) { + return res.status(500).json({ success: false, error: error.message }); + } + return res.status(500).json({ success: false, error }); + } +}; diff --git a/express-api/src/middleware/keycloak/controllers/logoutCallback.ts b/express-api/src/middleware/keycloak/controllers/logoutCallback.ts new file mode 100644 index 000000000..61ccc2221 --- /dev/null +++ b/express-api/src/middleware/keycloak/controllers/logoutCallback.ts @@ -0,0 +1,22 @@ +import { RequestHandler } from 'express'; +import logger from '@/utilities/winstonLogger'; +import { FRONTEND_URL_CONFIG, refreshCookieOptions } from '../authConfig'; + +/** + * GET /auth/logout/callback + * Keycloak redirects here after a successful logout. Clears the refresh token + * cookie and redirects the user to the frontend. + */ +export const logoutCallback: RequestHandler = async (_req, res) => { + try { + return res + .cookie('refresh_token', '', { ...refreshCookieOptions, maxAge: 0 }) + .redirect(FRONTEND_URL_CONFIG ?? ''); + } catch (error) { + logger.error('SSO logoutCallback controller error:', error); + if (error instanceof Error) { + return res.status(500).json({ success: false, error: error.message }); + } + return res.status(500).json({ success: false, error }); + } +}; diff --git a/express-api/src/middleware/keycloak/controllers/token.ts b/express-api/src/middleware/keycloak/controllers/token.ts new file mode 100644 index 000000000..559d0f0b1 --- /dev/null +++ b/express-api/src/middleware/keycloak/controllers/token.ts @@ -0,0 +1,46 @@ +import { RequestHandler } from 'express'; +import { getNewTokens } from '@bcgov/citz-imb-sso-js-core'; +import type { SSOEnvironment, SSOProtocol } from '@bcgov/citz-imb-sso-js-core'; +import logger from '@/utilities/winstonLogger'; +import { refreshCookieOptions, ssoClient } from '../authConfig'; + +/** + * POST /auth/token + * Refreshes tokens using the refresh_token cookie via js-core's `getNewTokens`, + * mirroring the citz-grs-dats implementation. getNewTokens first validates the + * refresh token locally (expiry check only - no introspection), then exchanges + * it at Keycloak's token endpoint. The response shape matches what the + * @bcgov/citz-imb-sso-react frontend package expects. + */ +export const token: RequestHandler = async (req, res) => { + const { refresh_token } = req.cookies; + if (!refresh_token || refresh_token === '') { + return res.status(401).send('Cookies must include refresh_token.'); + } + try { + const tokens = await getNewTokens({ + refreshToken: refresh_token, + clientID: ssoClient.clientID, + clientSecret: ssoClient.clientSecret, + ssoEnvironment: ssoClient.ssoEnvironment as SSOEnvironment, + ssoRealm: ssoClient.ssoRealm, + ssoProtocol: ssoClient.ssoProtocol as SSOProtocol, + }); + if (!tokens) { + return res.status(401).json({ success: false, message: 'Invalid token.' }); + } + // Keep the refresh cookie in sync in case the SSO server rotates it. + res.cookie('refresh_token', tokens.refresh_token, refreshCookieOptions); + return res.json({ + access_token: tokens.access_token, + id_token: tokens.id_token, + expires_in: tokens.expires_in, + }); + } catch (error) { + logger.error('SSO token controller error:', error); + if (error instanceof Error) { + return res.status(500).json({ success: false, error: error.message }); + } + return res.status(500).json({ success: false, error }); + } +}; diff --git a/express-api/src/middleware/keycloak/keycloakOptions.ts b/express-api/src/middleware/keycloak/keycloakOptions.ts index 782e2805a..dc44ad6a6 100644 --- a/express-api/src/middleware/keycloak/keycloakOptions.ts +++ b/express-api/src/middleware/keycloak/keycloakOptions.ts @@ -1,12 +1,17 @@ -import { SSOOptions, SSOUser } from '@bcgov/citz-imb-sso-express'; +import { SSOUser } from '@/middleware/keycloak/ssoUser'; import logger from '@/utilities/winstonLogger'; import { AppDataSource } from '@/appDataSource'; import { User } from '@/typeorm/Entities/User'; const users = AppDataSource.getRepository(User); +export interface SSOOptions { + afterUserLogin: (user: SSOUser) => Promise; + afterUserLogout: (user: SSOUser) => void; +} + /** - * Defined by SSO package. See package GitHub repo for options. + * Hooks called by the auth controllers on login and logout. */ export const SSO_OPTIONS: SSOOptions = { afterUserLogin: async (user: SSOUser) => { diff --git a/express-api/src/middleware/keycloak/protectedRoute.ts b/express-api/src/middleware/keycloak/protectedRoute.ts new file mode 100644 index 000000000..102776a64 --- /dev/null +++ b/express-api/src/middleware/keycloak/protectedRoute.ts @@ -0,0 +1,45 @@ +import { NextFunction, Request, RequestHandler, Response } from 'express'; +import { decodeJWT, isJWTValid, normalizeUser } from '@bcgov/citz-imb-sso-js-core'; +import { ssoClient } from './authConfig'; + +/** + * Middleware that validates the access token presented in the Authorization + * header and attaches the normalized user to `req.user`. Must be followed by + * `userAuthCheck` for routes that need a PIMS user record. + */ +const protectedRoute = (): RequestHandler => { + const middleware = async (req: Request, res: Response, next: NextFunction) => { + const header = req.headers.authorization; + if (!header) { + return res.status(401).json({ error: 'No authorization header found.' }); + } + const token = header.split(' ')[1]; + if (!token) { + return res.status(401).json({ error: 'No authorization token found.' }); + } + try { + const isTokenValid = await isJWTValid({ jwt: token, ...ssoClient }); + if (!isTokenValid) { + return res + .status(401) + .json({ error: 'Unauthorized: Invalid token, re-log to get a new one.' }); + } + const userInfo = decodeJWT(token); + const normalizedUser = normalizeUser(userInfo); + if (!userInfo || !normalizedUser) { + return res.status(404).json({ error: 'User not found.' }); + } + req.token = token; + req.user = normalizedUser; + next(); + } catch (error) { + if (error instanceof Error) { + return res.status(401).json({ error: error.message }); + } + return res.status(401).json({ error: 'Unknown authentication error.' }); + } + }; + return middleware; +}; + +export default protectedRoute; diff --git a/express-api/src/middleware/keycloak/ssoUser.ts b/express-api/src/middleware/keycloak/ssoUser.ts new file mode 100644 index 000000000..1be65285d --- /dev/null +++ b/express-api/src/middleware/keycloak/ssoUser.ts @@ -0,0 +1,35 @@ +/** + * Local SSO user type used across the API. + * + * Structurally compatible with the normalized user produced by `normalizeUser` + * from `@bcgov/citz-imb-sso-js-core`, which the auth module attaches to + * `req.user`. The permissive index signature keeps provider-specific claims + * (idir_user_guid, bceid_username, etc.) accessible. + */ +export interface SSOUser { + preferred_username: string; + display_name?: string; + first_name?: string; + last_name?: string; + email?: string; + guid?: string; + username?: string; + client_roles?: string[]; + identity_provider?: unknown; + hasRoles?: (roles: string[], options?: { requireAllRoles?: boolean }) => boolean; + name?: string; + originalData?: unknown; + originalTokenPayload?: unknown; + [key: string]: unknown; +} + +// Ensure user and token are a part of the Request object by default. +declare global { + // eslint-disable-next-line @typescript-eslint/no-namespace + namespace Express { + interface Request { + user?: SSOUser; + token?: string; + } + } +} diff --git a/express-api/src/middleware/userAuthCheck.ts b/express-api/src/middleware/userAuthCheck.ts index f21739202..6a68ceb0e 100644 --- a/express-api/src/middleware/userAuthCheck.ts +++ b/express-api/src/middleware/userAuthCheck.ts @@ -1,7 +1,7 @@ import { AppDataSource } from '@/appDataSource'; import { Roles } from '@/constants/roles'; import { User } from '@/typeorm/Entities/User'; -import { SSOUser } from '@bcgov/citz-imb-sso-express'; +import { SSOUser } from '@/middleware/keycloak/ssoUser'; import { NextFunction, RequestHandler, Response } from 'express'; export interface UserCheckOptions { @@ -10,7 +10,7 @@ export interface UserCheckOptions { /** * Middleware function to check user authentication and authorization. - * Must be preceeded by protectedRoute (from SSO packages) at some point. + * Must be preceded by protectedRoute at some point. * * @param options.requiredRoles - A list of Roles needed to pass this check. * @returns Express RequestHandler function to perform user authentication checks. diff --git a/express-api/src/services/users/usersServices.ts b/express-api/src/services/users/usersServices.ts index 15ef574a7..2ea44fdb6 100644 --- a/express-api/src/services/users/usersServices.ts +++ b/express-api/src/services/users/usersServices.ts @@ -1,6 +1,6 @@ import { User, UserStatus } from '@/typeorm/Entities/User'; import { AppDataSource } from '@/appDataSource'; -import { SSOUser } from '@bcgov/citz-imb-sso-express'; +import { SSOUser } from '@/middleware/keycloak/ssoUser'; import { DeepPartial, FindOptionsOrderValue, In } from 'typeorm'; import { Agency } from '@/typeorm/Entities/Agency'; import { randomUUID, UUID } from 'crypto'; diff --git a/express-api/src/utilities/authorizationChecks.ts b/express-api/src/utilities/authorizationChecks.ts index 45e006d0b..c3f15c644 100644 --- a/express-api/src/utilities/authorizationChecks.ts +++ b/express-api/src/utilities/authorizationChecks.ts @@ -1,4 +1,4 @@ -import { SSOUser } from '@bcgov/citz-imb-sso-express'; +import { SSOUser } from '@/middleware/keycloak/ssoUser'; import { Roles } from '@/constants/roles'; import userServices, { getUser } from '@/services/users/usersServices'; import { PimsRequestUser } from '@/middleware/userAuthCheck'; diff --git a/express-api/tests/testUtils/factories.ts b/express-api/tests/testUtils/factories.ts index 32f18793c..140fef7de 100644 --- a/express-api/tests/testUtils/factories.ts +++ b/express-api/tests/testUtils/factories.ts @@ -5,7 +5,7 @@ import { faker } from '@faker-js/faker'; import { UUID, randomUUID } from 'crypto'; import { Request, Response } from 'express'; import { Role as RolesEntity } from '@/typeorm/Entities/Role'; -import { SSOUser } from '@bcgov/citz-imb-sso-express'; +import { SSOUser } from '@/middleware/keycloak/ssoUser'; import { Parcel } from '@/typeorm/Entities/Parcel'; import { Building } from '@/typeorm/Entities/Building'; import { diff --git a/express-api/tests/unit/controllers/users/usersController.test.ts b/express-api/tests/unit/controllers/users/usersController.test.ts index 56af5e76f..4427beb34 100644 --- a/express-api/tests/unit/controllers/users/usersController.test.ts +++ b/express-api/tests/unit/controllers/users/usersController.test.ts @@ -8,7 +8,8 @@ import { produceUser, } from '../../../testUtils/factories'; import { faker } from '@faker-js/faker'; -import { SSOIdirUser, SSOUser } from '@bcgov/citz-imb-sso-express'; +import type { SSOIdirUser } from '@bcgov/citz-imb-sso-js-core'; +import type { SSOUser } from '@/middleware/keycloak/ssoUser'; import { Roles } from '@/constants/roles'; import { UUID } from 'crypto'; @@ -123,7 +124,7 @@ describe('UNIT - Testing controllers for users routes.', () => { it('should return the internal user corresponding to this keycloak', async () => { const kcUser = produceSSO(); _normalizeKeycloakUser.mockImplementationOnce(() => ({ - guid: (kcUser as SSOIdirUser).idir_user_guid, + guid: (kcUser as unknown as SSOIdirUser).idir_user_guid, })); mockRequest.user = kcUser; await getSelf(mockRequest, mockResponse); @@ -133,7 +134,7 @@ describe('UNIT - Testing controllers for users routes.', () => { it('should return no data', async () => { const kcUser = produceSSO(); _normalizeKeycloakUser.mockImplementationOnce(() => ({ - guid: (kcUser as SSOIdirUser).idir_user_guid, + guid: (kcUser as unknown as SSOIdirUser).idir_user_guid, })); _getUser.mockImplementationOnce(() => null); mockRequest.user = kcUser; diff --git a/express-api/tests/unit/services/users/usersServices.test.ts b/express-api/tests/unit/services/users/usersServices.test.ts index 2962ebc47..9d7e60b35 100644 --- a/express-api/tests/unit/services/users/usersServices.test.ts +++ b/express-api/tests/unit/services/users/usersServices.test.ts @@ -4,7 +4,7 @@ import { IKeycloakRole } from '@/services/keycloak/IKeycloakRole'; import userServices from '@/services/users/usersServices'; import { Agency } from '@/typeorm/Entities/Agency'; import { User } from '@/typeorm/Entities/User'; -import { SSOUser } from '@bcgov/citz-imb-sso-express'; +import type { SSOUser } from '@/middleware/keycloak/ssoUser'; import { faker } from '@faker-js/faker'; import { produceAgency, produceUser, produceSSO } from 'tests/testUtils/factories'; import { DeepPartial } from 'typeorm'; diff --git a/express-api/tsconfig.json b/express-api/tsconfig.json index 9c5daa16c..4dbbd4ef3 100644 --- a/express-api/tsconfig.json +++ b/express-api/tsconfig.json @@ -13,7 +13,8 @@ "outDir": "dist", "emitDecoratorMetadata": true, "experimentalDecorators": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "skipLibCheck": true }, "include": ["./**/*"] }