Add ability to get provider by name from auth service
This commit is contained in:
parent
5616b3cc1f
commit
36647a013d
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@extollo/lib",
|
"name": "@extollo/lib",
|
||||||
"version": "0.9.32",
|
"version": "0.9.33",
|
||||||
"description": "The framework library that lifts up your code.",
|
"description": "The framework library that lifts up your code.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
@ -27,6 +27,15 @@ export class Authentication extends Unit {
|
|||||||
|
|
||||||
protected providers: {[name: string]: LoginProvider<LoginProviderConfig>} = {}
|
protected providers: {[name: string]: LoginProvider<LoginProviderConfig>} = {}
|
||||||
|
|
||||||
|
getProvider(name: string): LoginProvider<LoginProviderConfig> {
|
||||||
|
const provider = this.providers[name]
|
||||||
|
if ( !provider ) {
|
||||||
|
throw new ErrorWithContext('Invalid auth provider name: ' + name, { name })
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider
|
||||||
|
}
|
||||||
|
|
||||||
async up(): Promise<void> {
|
async up(): Promise<void> {
|
||||||
this.middleware.registerNamespace('@auth', this.getMiddlewareResolver())
|
this.middleware.registerNamespace('@auth', this.getMiddlewareResolver())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user