thiagobustamante / typescript-rest

This is a lightweight annotation-based expressjs extension for typescript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple @Security tags?

mr-short opened this issue · comments

Using multiple security tags does not seem to work on a specific route or controller. It only uses the first one.

Is this supported?

The answer is no, it is not supported. It looks like roles and authenticator are hard-coded properties on the decorated object, so additional @Security tags just overwrite it.

return new ServiceDecorator('Security')
    .withProperty('roles', roles)
    .withProperty('authenticator', name || 'default')
buildSecurityMiddlewares(serviceClass, serviceMethod) {
    let roles = _.compact(_.union(serviceMethod.roles, serviceClass.roles));
    const authenticatorName = serviceMethod.authenticator || serviceClass.authenticator;