Skip to content

Commit c561f9a

Browse files
committed
add posture data to all MFA connection requests
1 parent 3f810fc commit c561f9a

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

new-ui/src/shared/components/LocationCard/hooks/useMfaConnect.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,17 @@ export const useMfaConnect = (method: 0 | 1) => {
7373
return;
7474
}
7575

76-
const posture_data = location.posture_check_required
77-
? await api.getPostureData()
78-
: undefined;
76+
let posture_data: unknown;
77+
try {
78+
posture_data = location.posture_check_required
79+
? await api.getPostureData()
80+
: undefined;
81+
} catch {
82+
setStartError('Failed to load posture data');
83+
setIsStarting(false);
84+
return;
85+
}
86+
7987
try {
8088
const res = await fetch(`${instance.proxy_url}${MFA_ENDPOINT}/start`, {
8189
method: 'POST',

new-ui/src/shared/components/LocationCard/hooks/useMfaMobileConnect.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,17 @@ export const useMfaMobileConnect = () => {
153153
return;
154154
}
155155

156+
let posture_data: unknown;
157+
try {
158+
posture_data = location.posture_check_required
159+
? await api.getPostureData()
160+
: undefined;
161+
} catch {
162+
setStartError('Failed to load posture data');
163+
setIsStarting(false);
164+
return;
165+
}
166+
156167
try {
157168
const res = await fetch(`${instance.proxy_url}${MFA_ENDPOINT}/start`, {
158169
method: 'POST',
@@ -161,6 +172,7 @@ export const useMfaMobileConnect = () => {
161172
method: 4,
162173
pubkey: instance.pubkey,
163174
location_id: location.network_id,
175+
posture_data,
164176
}),
165177
});
166178

new-ui/src/shared/components/LocationCard/hooks/useMfaOidcConnect.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ export const useMfaOidcConnect = () => {
137137
return;
138138
}
139139

140+
let posture_data: unknown;
141+
try {
142+
posture_data = location.posture_check_required
143+
? await api.getPostureData()
144+
: undefined;
145+
} catch {
146+
setStartError('Failed to load posture data');
147+
setIsStarting(false);
148+
return;
149+
}
150+
140151
try {
141152
const res = await fetch(`${instance.proxy_url}${MFA_ENDPOINT}/start`, {
142153
method: 'POST',
@@ -145,6 +156,7 @@ export const useMfaOidcConnect = () => {
145156
method: 2,
146157
pubkey: instance.pubkey,
147158
location_id: location.network_id,
159+
posture_data,
148160
}),
149161
});
150162

0 commit comments

Comments
 (0)