Skip to content
Snippets Groups Projects

Feature/nat 569 add opa to gui2

Merged Mohammad Torkashvand requested to merge feature/NAT-569-add-opa-to-gui2 into develop
All threads resolved!
Files
5
@@ -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,
};
Loading