From d925b0cc5f9abf65619f5bce42dea9ae40092b51 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 24 May 2020 18:38:24 +0200 Subject: [PATCH] Types and lint fixes in lib/web/auth Signed-off-by: David Mehren --- src/lib/web/auth/dropbox/index.ts | 2 +- src/lib/web/auth/google/index.ts | 2 +- src/lib/web/auth/oauth2/oauth2-custom-strategy.ts | 2 +- src/lib/web/auth/utils.ts | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/web/auth/dropbox/index.ts b/src/lib/web/auth/dropbox/index.ts index bf8db04a6..a6f4d750e 100644 --- a/src/lib/web/auth/dropbox/index.ts +++ b/src/lib/web/auth/dropbox/index.ts @@ -18,7 +18,7 @@ export const DropboxMiddleware: AuthMiddleware = { }, ( accessToken: string, refreshToken: string, - profile: any, + profile, done: (err?: Error | null, user?: User) => void ): void => { // the Dropbox plugin wraps the email addresses in an object diff --git a/src/lib/web/auth/google/index.ts b/src/lib/web/auth/google/index.ts index 54c2753ed..165d1f7e5 100644 --- a/src/lib/web/auth/google/index.ts +++ b/src/lib/web/auth/google/index.ts @@ -17,7 +17,7 @@ export const GoogleMiddleware: AuthMiddleware = { }, ( accessToken: string, refreshToken: string, - profile: any, + profile, done) => { /* This ugly hack is neccessary, because the Google Strategy wants a done-callback with an err as Error | null | undefined diff --git a/src/lib/web/auth/oauth2/oauth2-custom-strategy.ts b/src/lib/web/auth/oauth2/oauth2-custom-strategy.ts index 4fec1cbc8..a6b80fcc3 100644 --- a/src/lib/web/auth/oauth2/oauth2-custom-strategy.ts +++ b/src/lib/web/auth/oauth2/oauth2-custom-strategy.ts @@ -2,7 +2,7 @@ import { InternalOAuthError, Strategy as OAuth2Strategy } from 'passport-oauth2' import { config } from '../../../config' import { Profile, ProviderEnum } from '../../../models/user' -function extractProfileAttribute (data, path: string): any { +function extractProfileAttribute (data, path: string): string { // can handle stuff like `attrs[0].name` const pathArray = path.split('.') for (const segment of pathArray) { diff --git a/src/lib/web/auth/utils.ts b/src/lib/web/auth/utils.ts index bf0de1fc6..025b21478 100644 --- a/src/lib/web/auth/utils.ts +++ b/src/lib/web/auth/utils.ts @@ -1,10 +1,11 @@ +import { Profile } from 'passport' import { User } from '../../models' import { logger } from '../../logger' export function passportGeneralCallback ( accessToken: string, refreshToken: string, - profile: any, + profile: Profile, done: (err?: Error | null, user?: User) => void ): void { const stringifiedProfile = JSON.stringify(profile)