-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ea3047
commit dcc8828
Showing
1 changed file
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* @adonisjs/shield | ||
* | ||
* (c) Harminder Virk <virk@adonisjs.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
import { IocContract } from '@adonisjs/fold' | ||
|
||
export class ShieldProvider { | ||
constructor (protected container: IocContract) {} | ||
|
||
public register () { | ||
this.container.singleton('Adonis/Addons/ShieldMiddleware', () => { | ||
const Config = this.container.use('Adonis/Core/Config') | ||
const shieldConfig = Config.get('shield', {}) | ||
new (require('../src/ShieldMiddleware').ShieldMiddleware)(shieldConfig) | ||
}) | ||
} | ||
|
||
public boot () { | ||
this.container.with(['Adonis/Core/Response'], (Response) => { | ||
require('../src/Bindings/Response').responseBinding(Response) | ||
}) | ||
} | ||
} |