|
|
@ -7,6 +7,7 @@ import {SessionSecurityContext} from '../contexts/SessionSecurityContext'
|
|
|
|
import {SecurityContext} from '../SecurityContext'
|
|
|
|
import {SecurityContext} from '../SecurityContext'
|
|
|
|
import {ORMUserRepository} from '../orm/ORMUserRepository'
|
|
|
|
import {ORMUserRepository} from '../orm/ORMUserRepository'
|
|
|
|
import {AuthConfig, AuthenticatableRepositories} from '../config'
|
|
|
|
import {AuthConfig, AuthenticatableRepositories} from '../config'
|
|
|
|
|
|
|
|
import {Logging} from '../../service/Logging'
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Injects a SessionSecurityContext into the request and attempts to
|
|
|
|
* Injects a SessionSecurityContext into the request and attempts to
|
|
|
@ -17,7 +18,11 @@ export class SessionAuthMiddleware extends Middleware {
|
|
|
|
@Inject()
|
|
|
|
@Inject()
|
|
|
|
protected readonly config!: Config
|
|
|
|
protected readonly config!: Config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Inject()
|
|
|
|
|
|
|
|
protected readonly logging!: Logging
|
|
|
|
|
|
|
|
|
|
|
|
async apply(): Promise<ResponseObject> {
|
|
|
|
async apply(): Promise<ResponseObject> {
|
|
|
|
|
|
|
|
this.logging.debug('Applying session auth middleware...')
|
|
|
|
const context = <SessionSecurityContext> this.make(SessionSecurityContext, this.getRepository())
|
|
|
|
const context = <SessionSecurityContext> this.make(SessionSecurityContext, this.getRepository())
|
|
|
|
this.request.registerSingletonInstance(SecurityContext, context)
|
|
|
|
this.request.registerSingletonInstance(SecurityContext, context)
|
|
|
|
await context.resume()
|
|
|
|
await context.resume()
|
|
|
|