Skip to content

Commit

Permalink
COLUMBIA: Auth2 external access services use a well-known key to trac…
Browse files Browse the repository at this point in the history
…k auth
  • Loading branch information
barmintor committed Feb 1, 2025
1 parent f8d6216 commit b1d0bb4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/state/selectors/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,17 @@ export const selectCurrentAuthServices = createSelector(
const probeServices = anyProbeServices(resource);
const probeServiceServices = flatten(probeServices.map(p => Utils.getServices(p)));

const allAuthServices = resourceServices.concat(probeServiceServices);

for (const authProfile of serviceProfiles) {
const profiledAuthServices = resourceServices.concat(probeServiceServices).filter(
const profiledAuthServices = allAuthServices.filter(
p => authProfile.profile === p.getProfile(),
);

for (const service of profiledAuthServices) {
lastAttemptedService = service;
// external service may have no id to track by (auth1 vs auth2)
const serviceKey = (authProfile.external) ? (service?.id || 'external') : service?.id;
const serviceKey = (authProfile.external) ? 'external' : service?.id;

if (!auth[serviceKey] || auth[serviceKey].isFetching || auth[serviceKey].ok) {
return service;
Expand All @@ -103,10 +105,11 @@ export const selectCurrentAuthServices = createSelector(
return Object.values(currentAuthServices.reduce((h, service) => {
if (!service) return h;
const external = serviceProfiles.filter(x => x.external).find(s => (s.profile === service.getProfile()));
const serviceKey = (external) ? (service.id || 'external') : service.id;
const serviceKey = (external) ? 'external' : service.id;
if (!h[serviceKey]) {
h[serviceKey] = service; // eslint-disable-line no-param-reassign
}

return h;
}, {}));
},
Expand Down

0 comments on commit b1d0bb4

Please sign in to comment.