Skip to content

Commit

Permalink
Adds session validation to composition
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbs committed Nov 6, 2023
1 parent ff014c3 commit 1ab92ea
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/composition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Auth0Session from "@/common/session/Auth0Session"
import CachingProjectDataSource from "@/features/projects/domain/CachingProjectDataSource"
import GitHubClient from "@/common/github/GitHubClient"
import GitHubOAuthTokenRefresher from "@/features/auth/data/GitHubOAuthTokenRefresher"
import GitHubOrganizationSessionValidator from "@/common/session/GitHubOrganizationSessionValidator"
import GitHubProjectDataSource from "@/features/projects/data/GitHubProjectDataSource"
import InitialOAuthTokenService from "@/features/auth/domain/InitialOAuthTokenService"
import KeyValueUserDataRepository from "@/common/userData/KeyValueUserDataRepository"
Expand All @@ -15,6 +16,7 @@ import SessionDataRepository from "@/common/userData/SessionDataRepository"
import SessionMutexFactory from "@/common/mutex/SessionMutexFactory"
import SessionOAuthTokenRepository from "@/features/auth/domain/SessionOAuthTokenRepository"
import SessionProjectRepository from "@/features/projects/domain/SessionProjectRepository"
import SessionValidatingProjectDataSource from "@/features/projects/domain/SessionValidatingProjectDataSource"
import OAuthTokenRepository from "@/features/auth/domain/OAuthTokenRepository"
import authLogoutHandler from "@/common/authHandler/logout"

Expand Down Expand Up @@ -70,6 +72,11 @@ export const gitHubClient = new AccessTokenRefreshingGitHubClient(
})
)

export const sessionValidator = new GitHubOrganizationSessionValidator(
gitHubClient,
GITHUB_ORGANIZATION_NAME
)

export const sessionProjectRepository = new SessionProjectRepository(
new SessionDataRepository(
new Auth0Session(),
Expand All @@ -81,9 +88,12 @@ export const sessionProjectRepository = new SessionProjectRepository(
)

export const projectDataSource = new CachingProjectDataSource(
new GitHubProjectDataSource(
gitHubClient,
GITHUB_ORGANIZATION_NAME
new SessionValidatingProjectDataSource(
sessionValidator,
new GitHubProjectDataSource(
gitHubClient,
GITHUB_ORGANIZATION_NAME
)
),
sessionProjectRepository
)
Expand Down

0 comments on commit 1ab92ea

Please sign in to comment.