Skip to content

Commit

Permalink
fix: authInfo destructure
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Mar 7, 2024
1 parent 7ba2d5e commit 1ad00b3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/workspace/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export const getPrincipalsFromRequest = (
}

if (authInfoResp?.status === AuthStatus.authenticated) {
const authInfo = authInfoResp?.state as AuthInfo | null;
if (authInfo?.backend_roles) {
payload[PrincipalType.Groups] = authInfo.backend_roles;
const authInfo = authInfoResp?.state as { authInfo: AuthInfo } | null;
if (authInfo?.authInfo.backend_roles) {
payload[PrincipalType.Groups] = authInfo.authInfo.backend_roles;
}
if (authInfo?.user_name) {
payload[PrincipalType.Users] = [authInfo.user_name];
if (authInfo?.authInfo.user_name) {
payload[PrincipalType.Users] = [authInfo.authInfo.user_name];
}
return payload;
}
Expand Down

0 comments on commit 1ad00b3

Please sign in to comment.