Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
authentication: make it a proper component
Export `AuthenticationComponent` that registers providers for `authenticate` action and current-route metadata. Simplify usage of `authenticate` action by shifting the complexity of deferring metadata resolution into the action itself (using the new `@inject.getter` decorator), so that custom Sequence implementations can inject this action the same way as other actions are injected. Improve README - fix markdown formatting, reword introductory texts, improve the usage example. Clean up the code in general - fix spelling mistakes, organize files into `decorators` and `providers` folders.
- Loading branch information
Showing
14 changed files
with
244 additions
and
105 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright IBM Corp. 2013,2017. All Rights Reserved. | ||
// Node module: @loopback/authentication | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
|
||
import {BindingKeys} from './keys'; | ||
import {Constructor} from '@loopback/context'; | ||
import {Component, ProviderMap} from '@loopback/core'; | ||
import {AuthenticationProvider} from './providers/authenticate'; | ||
import {AuthMetadataProvider} from './providers/auth-metadata'; | ||
|
||
export class AuthenticationComponent implements Component { | ||
providers?: ProviderMap; | ||
|
||
// TODO(bajtos) inject configuration | ||
constructor() { | ||
this.providers = { | ||
[BindingKeys.Authentication.AUTH_ACTION]: AuthenticationProvider, | ||
[BindingKeys.Authentication.METADATA]: AuthMetadataProvider, | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.