Skip to content

Commit

Permalink
fix missing statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanslatten committed Oct 31, 2024
1 parent 1db79ba commit c234cc9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugins/arcgis/service/src/ArcGISIdentityManagerFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const OAuthIdentityManagerFactory: ArcGISIdentityManagerFactory = {
});

// Update authToken to new token
const config = await processor.safeGetConfig();
const config = await processor.safeGetConfig(true);
let service = config.featureServices.find(service => service.url === portal)?.auth as OAuthAuthConfig;
const date = new Date();
date.setSeconds(date.getSeconds() + response.expires_in || 0);
Expand Down
2 changes: 1 addition & 1 deletion plugins/arcgis/service/src/ObservationProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class ObservationProcessor {
return config
}

private sanitizeFeatureService(config: FeatureServiceConfig, type: AuthType): FeatureServiceConfig {
public sanitizeFeatureService(config: FeatureServiceConfig, type: AuthType): FeatureServiceConfig {
if (type === AuthType.OAuth) {
const newAuth = Object.assign({}, config.auth) as OAuthAuthConfig;
delete newAuth.refreshToken;
Expand Down
10 changes: 5 additions & 5 deletions plugins/arcgis/service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const arcgisPluginHooks: InitPluginHook<typeof InjectedServices> = {
return res.status(404).send('clientId is required')
}

const config = await processor.safeGetConfig()
const config = await processor.safeGetConfig(true)
ArcGISIdentityManager.authorize({
clientId,
portal: getPortalUrl(url),
Expand All @@ -95,7 +95,7 @@ const arcgisPluginHooks: InitPluginHook<typeof InjectedServices> = {
return res.sendStatus(500)
}

const config = await processor.safeGetConfig()
const config = await processor.safeGetConfig(true)
const creds = {
clientId: state.clientId,
redirectUri: `${config.baseUrl}/${pluginWebRoute}/oauth/authenticate`,
Expand Down Expand Up @@ -161,7 +161,7 @@ const arcgisPluginHooks: InitPluginHook<typeof InjectedServices> = {
})

routes.post('/featureService/validate', async (req, res) => {
const config = await processor.safeGetConfig()
const config = await processor.safeGetConfig(true)
const { url, auth = {} } = req.body
const { token, username, password } = auth
if (!URL.canParse(url)) {
Expand All @@ -188,15 +188,15 @@ const arcgisPluginHooks: InitPluginHook<typeof InjectedServices> = {
}
console.log('values patch')
await processor.patchConfig(config)
return res.send(service)
return res.send(processor.sanitizeFeatureService(service, AuthType.OAuth))
} catch (err) {
return res.send('Invalid credentials provided to communicate with feature service').status(400)
}
})

routes.get('/featureService/layers', async (req, res, next) => {
const url = req.query.featureServiceUrl as string
const config = await processor.safeGetConfig()
const config = await processor.safeGetConfig(true)
const featureService = config.featureServices.find(featureService => featureService.url === url)
if (!featureService) {
return res.status(400)
Expand Down

0 comments on commit c234cc9

Please sign in to comment.