mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
Types and lint fixes in lib/web/auth
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
762e58b0d4
commit
d925b0cc5f
4 changed files with 5 additions and 4 deletions
|
@ -18,7 +18,7 @@ export const DropboxMiddleware: AuthMiddleware = {
|
||||||
}, (
|
}, (
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
refreshToken: string,
|
refreshToken: string,
|
||||||
profile: any,
|
profile,
|
||||||
done: (err?: Error | null, user?: User) => void
|
done: (err?: Error | null, user?: User) => void
|
||||||
): void => {
|
): void => {
|
||||||
// the Dropbox plugin wraps the email addresses in an object
|
// the Dropbox plugin wraps the email addresses in an object
|
||||||
|
|
|
@ -17,7 +17,7 @@ export const GoogleMiddleware: AuthMiddleware = {
|
||||||
}, (
|
}, (
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
refreshToken: string,
|
refreshToken: string,
|
||||||
profile: any,
|
profile,
|
||||||
done) => {
|
done) => {
|
||||||
/*
|
/*
|
||||||
This ugly hack is neccessary, because the Google Strategy wants a done-callback with an err as Error | null | undefined
|
This ugly hack is neccessary, because the Google Strategy wants a done-callback with an err as Error | null | undefined
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { InternalOAuthError, Strategy as OAuth2Strategy } from 'passport-oauth2'
|
||||||
import { config } from '../../../config'
|
import { config } from '../../../config'
|
||||||
import { Profile, ProviderEnum } from '../../../models/user'
|
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`
|
// can handle stuff like `attrs[0].name`
|
||||||
const pathArray = path.split('.')
|
const pathArray = path.split('.')
|
||||||
for (const segment of pathArray) {
|
for (const segment of pathArray) {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import { Profile } from 'passport'
|
||||||
import { User } from '../../models'
|
import { User } from '../../models'
|
||||||
import { logger } from '../../logger'
|
import { logger } from '../../logger'
|
||||||
|
|
||||||
export function passportGeneralCallback (
|
export function passportGeneralCallback (
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
refreshToken: string,
|
refreshToken: string,
|
||||||
profile: any,
|
profile: Profile,
|
||||||
done: (err?: Error | null, user?: User) => void
|
done: (err?: Error | null, user?: User) => void
|
||||||
): void {
|
): void {
|
||||||
const stringifiedProfile = JSON.stringify(profile)
|
const stringifiedProfile = JSON.stringify(profile)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue