-
-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Expire and remove authenticated real-time connections (#1512)
- Loading branch information
Showing
8 changed files
with
93 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
import { HookContext } from '@feathersjs/feathers'; | ||
import { omit } from 'lodash'; | ||
import { AuthenticationBase, ConnectionEvent } from '../core'; | ||
|
||
import { AuthenticationBase } from '../core'; | ||
|
||
export default () => async (context: HookContext) => { | ||
export default (event: ConnectionEvent) => async (context: HookContext) => { | ||
const { result, params: { connection } } = context; | ||
|
||
if (!connection) { | ||
return context; | ||
} | ||
|
||
const service = context.service as unknown as AuthenticationBase; | ||
const strategies = service.getStrategies(...Object.keys(service.strategies)) | ||
.filter(current => typeof current.handleConnection === 'function'); | ||
|
||
Object.assign(connection, omit(result, 'accessToken', 'authentication')); | ||
|
||
for (const strategy of strategies) { | ||
await strategy.handleConnection(connection, context); | ||
} | ||
await service.handleConnection(event, connection, result); | ||
|
||
return context; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters