Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions site-config/hca-dcp/ma-prod/authentication/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { AuthenticationConfig } from "@databiosphere/findable-ui/lib/config/entities";
import * as MDX from "../../../../app/components/common/MDXContent/hca-dcp";
import { GOOGLE_PROVIDER, TERRA_SERVICE } from "./constants";
import { getGoogleProvider, TERRA_SERVICE } from "./constants";

/**
* Returns the authentication config for HCA DCP MA-PROD environment.
* @param dataSourceUrl - Data source URL.
* @returns - Authentication config for HCA DCP MA-PROD environment.
*/
export function getAuthentication(): AuthenticationConfig {
export function getAuthentication(dataSourceUrl: string): AuthenticationConfig {
return {
providers: [GOOGLE_PROVIDER],
providers: [getGoogleProvider(dataSourceUrl)],
services: [TERRA_SERVICE],
termsOfService: MDX.LoginTermsOfService({}),
text: MDX.LoginText({}),
Expand Down
25 changes: 18 additions & 7 deletions site-config/hca-dcp/ma-prod/authentication/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,25 @@ import { GoogleProfile } from "@databiosphere/findable-ui/lib/google/types";
import { OAUTH_GOOGLE_SIGN_IN } from "../../../common/authentication";

const CLIENT_ID =
"473200283737-4pt6e9lraf5jbb650f9kp7ethelv4a8l.apps.googleusercontent.com";
"473200283737-h5e1l7neunbuesrtgjf8b12lb7o3jf1m.apps.googleusercontent.com";

export const GOOGLE_PROVIDER: OAuthProvider<GoogleProfile> = {
...GOOGLE_SIGN_IN_PROVIDER,
...OAUTH_GOOGLE_SIGN_IN,
clientId: CLIENT_ID,
flow: OAUTH_FLOW.IMPLICIT,
};
/**
* Returns the Google OAuth provider configured for the authorization code
* flow, with `authorize` derived from the given Azul base URL.
* @param dataSourceUrl - Azul base URL.
* @returns Google OAuth provider.
*/
export function getGoogleProvider(
dataSourceUrl: string
): OAuthProvider<GoogleProfile> {
return {
...GOOGLE_SIGN_IN_PROVIDER,
...OAUTH_GOOGLE_SIGN_IN,
authorize: `${dataSourceUrl}/user/authorize`,
clientId: CLIENT_ID,
flow: OAUTH_FLOW.AUTHORIZATION_CODE,
};
}

export const TERRA_SERVICE = {
endpoint: {
Expand Down
2 changes: 1 addition & 1 deletion site-config/hca-dcp/ma-prod/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const config = makeConfig(
DATA_URL,
GIT_HUB_REPO_URL,
CATALOG,
getAuthentication()
getAuthentication(DATA_URL)
);

// Configure analytics for the prod environment.
Expand Down
Loading