feat(authentication): Google authentication provider (#6104)
* init * add entity_id and update provider * initial implementation * update lockfile * fix conflicts * add config variables * update types * refactor google provider * re-order methods * fix pr feedback p. 1 * add initial type and update callback authorization * add google provider to integration test * fix feedback * initial implementation (#6171) * initial implementation * remove oauth lib * move abstract authentication provider * shuffle files around * Update packages/authentication/src/migrations/Migration20240122041959.ts Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> * call verify with token --------- Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
co-authored by
Carlos R. L. Rodrigues
parent
c37c82c5b5
commit
b3d013940f
@@ -5,6 +5,7 @@ export type AuthProviderDTO = {
|
||||
name: string
|
||||
domain: ProviderDomain
|
||||
is_active: boolean
|
||||
config: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export type CreateAuthProviderDTO = {
|
||||
@@ -12,6 +13,7 @@ export type CreateAuthProviderDTO = {
|
||||
name: string
|
||||
domain?: ProviderDomain
|
||||
is_active?: boolean
|
||||
config?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export type UpdateAuthProviderDTO = {
|
||||
@@ -19,6 +21,7 @@ export type UpdateAuthProviderDTO = {
|
||||
name?: string
|
||||
domain?: ProviderDomain
|
||||
is_active?: boolean
|
||||
config?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export enum ProviderDomain {
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from "./auth-user"
|
||||
export * from "./auth-provider"
|
||||
export * from "./provider"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export type AuthenticationResponse = {
|
||||
success: boolean
|
||||
authUser?: any
|
||||
error?: string
|
||||
}
|
||||
@@ -1,3 +1,2 @@
|
||||
export * from "./service"
|
||||
export * from "./common"
|
||||
export * from "./provider"
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { AuthUserDTO } from "./common"
|
||||
|
||||
export abstract class AbstractAuthenticationModuleProvider {
|
||||
public static PROVIDER: string
|
||||
public static DISPLAY_NAME: string
|
||||
|
||||
public get provider() {
|
||||
return (this.constructor as Function & { PROVIDER: string}).PROVIDER
|
||||
}
|
||||
|
||||
public get displayName() {
|
||||
return (this.constructor as Function & { DISPLAY_NAME: string}).DISPLAY_NAME
|
||||
}
|
||||
|
||||
abstract authenticate(
|
||||
data: Record<string, unknown>
|
||||
): Promise<AuthenticationResponse>
|
||||
}
|
||||
|
||||
export type AuthenticationResponse = {
|
||||
success: boolean
|
||||
authUser?: AuthUserDTO
|
||||
error?: string
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IModuleService } from "../modules-sdk"
|
||||
import {
|
||||
AuthenticationResponse,
|
||||
AuthProviderDTO,
|
||||
AuthUserDTO,
|
||||
CreateAuthProviderDTO,
|
||||
@@ -9,9 +9,10 @@ import {
|
||||
UpdateAuthProviderDTO,
|
||||
UpdateAuthUserDTO,
|
||||
} from "./common"
|
||||
import { FindConfig } from "../common"
|
||||
|
||||
import { Context } from "../shared-context"
|
||||
import { AuthenticationResponse } from "./provider"
|
||||
import { FindConfig } from "../common"
|
||||
import { IModuleService } from "../modules-sdk"
|
||||
|
||||
export interface IAuthenticationModuleService extends IModuleService {
|
||||
authenticate(
|
||||
|
||||
Reference in New Issue
Block a user