Skip to content
Snippets Groups Projects
Commit b722223a authored by Mohammad Torkashvand's avatar Mohammad Torkashvand
Browse files

renme config names

parent 7bc84281
No related branches found
No related tags found
No related merge requests found
Pipeline #86915 failed
This commit is part of merge request !22. Comments created here will be created in the context of that merge request.
......@@ -38,7 +38,7 @@ type Policy =
export const WfoAuthWithPolicy: FC<WfoAuthWithPolicyProps> = ({ children }) => {
const { authActive } = useContext(OrchestratorConfigContext);
const { publicBundleUrl, clientId } = useGsoConfig();
const { opaPublicBundleUrl, oidcClientId } = useGsoConfig();
const { status: sessionStatus, session } = useWfoSession({
required: authActive,
});
......@@ -50,7 +50,7 @@ export const WfoAuthWithPolicy: FC<WfoAuthWithPolicyProps> = ({ children }) => {
useEffect(() => {
const getPolicy = async () => {
try {
const policyResult = await fetch(publicBundleUrl);
const policyResult = await fetch(opaPublicBundleUrl);
const policyWasm = await policyResult.arrayBuffer();
const loadedPolicy = await loadPolicy(policyWasm);
......@@ -77,7 +77,7 @@ export const WfoAuthWithPolicy: FC<WfoAuthWithPolicyProps> = ({ children }) => {
}
getPolicy();
}, [authActive, publicBundleUrl, clientId]);
}, [authActive, opaPublicBundleUrl, oidcClientId]);
const isAllowedHandler = (routerPath: string, resource?: string) => {
if (session && policy.policyLoadingStatus === PolicyLoadingStatus.SUCCESS) {
......@@ -91,7 +91,7 @@ export const WfoAuthWithPolicy: FC<WfoAuthWithPolicyProps> = ({ children }) => {
const policyInput = {
resource: resource ?? routerPath,
active: true,
client_id: clientId,
client_id: oidcClientId,
method: 'GET',
...profile,
};
......
......@@ -5,8 +5,8 @@ import {
import getConfig from 'next/config';
export type gsoConfig = {
publicBundleUrl: string;
clientId: string;
opaPublicBundleUrl: string;
oidcClientId: string;
};
const { publicRuntimeConfig } = getConfig();
......@@ -57,7 +57,7 @@ export const getInitialOrchestratorConfig = (): OrchestratorConfig => {
export const getInitialGsoConfig = (): gsoConfig => {
return {
publicBundleUrl: publicRuntimeConfig.OPA_PUBLIC_BUNDLE_URL ?? '',
clientId: publicRuntimeConfig.NEXTAUTH_CLIENT_ID ?? '',
opaPublicBundleUrl: publicRuntimeConfig.OPA_PUBLIC_BUNDLE_URL ?? '',
oidcClientId: publicRuntimeConfig.NEXTAUTH_CLIENT_ID ?? '',
};
};
......@@ -2,14 +2,14 @@ import React, { createContext, useContext, ReactNode } from 'react';
// Define the shape of the GsoConfig
interface GsoConfig {
publicBundleUrl: string;
clientId: string;
opaPublicBundleUrl: string;
oidcClientId: string;
}
// Create the default values for the context
const defaultGsoConfig: GsoConfig = {
publicBundleUrl: 'asdasdsad',
clientId: 'asdasdasd',
opaPublicBundleUrl: '',
oidcClientId: '',
};
// Create the context
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment