feat(authentication, types, utils): Add Authentication provider scopes (#6228)

* initial implementation

* add test for invalid scope

* get config from scope not db

* assign config from scope

* fix package.json

* optional providers

* make providers options

* update type
This commit is contained in:
Philip Korsholm authored and GitHub committed 2024-01-29 17:42:42 +08:00
1 parent d1c18a3090
commit a41aad4bea
10 files changed
+150 -49

No files matched your search

@@ -2,4 +2,21 @@ export type AuthenticationResponse = {
success: boolean
authUser?: any
error?: string
location?: string
}
export type AuthModuleProviderConfig = {
name: string
scopes: Record<string, AuthProviderScope>
}
export type AuthProviderScope = Record<string, string>
export type AuthenticationInput = {
connection: { encrypted: boolean }
url: string
headers: Record<string, string>
query: Record<string, string>
body: Record<string, string>
scope: string
}
+4 -3
View File
@@ -1,7 +1,8 @@
import {
AuthenticationInput,
AuthenticationResponse,
AuthProviderDTO,
AuthUserDTO,
AuthenticationResponse,
CreateAuthProviderDTO,
CreateAuthUserDTO,
FilterableAuthProviderProps,
@@ -17,12 +18,12 @@ import { IModuleService } from "../modules-sdk"
export interface IAuthenticationModuleService extends IModuleService {
authenticate(
provider: string,
providerData: Record<string, unknown>
providerData: AuthenticationInput
): Promise<AuthenticationResponse>
validateCallback(
provider: string,
providerData: Record<string, unknown>
providerData: AuthenticationInput
): Promise<AuthenticationResponse>
retrieveAuthProvider(