feat(authentication, types): split authenticate method into two (#6184)

* init

* fetch providers using updated string

* update loaders

* add more tests

* add authenticationresponse type

* update types for authentication method

* add entity_id and update provider

* update pr with return type

* create loaders onApplicationStart

* cleanup provider class

* run application start hook before each

* fix pr feedback

* create private onApplicationStart method

* assign repository

* 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

* 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>

* split authentication methods

* call verify with token

* update integration tests

* feedback

* rename split methods

* fix provider integration test

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
Philip Korsholm
2024-01-26 11:37:23 +08:00
committed by GitHub
parent 5a550e73b4
commit 638b47ff70
7 changed files with 126 additions and 87 deletions
@@ -1,4 +1,4 @@
import { AuthenticationResponse } from "@medusajs/types";
import { AuthenticationResponse } from "@medusajs/types"
export abstract class AbstractAuthenticationModuleProvider {
public static PROVIDER: string
@@ -16,4 +16,12 @@ export abstract class AbstractAuthenticationModuleProvider {
abstract authenticate(
data: Record<string, unknown>
): Promise<AuthenticationResponse>
public validateCallback(
data: Record<string, unknown>
): Promise<AuthenticationResponse> {
throw new Error(
`Callback authentication not implemented for provider ${this.provider}`
)
}
}