All files / src/sso/client HandlerFactory.ts

92.31% Statements 12/13
87.5% Branches 7/8
100% Functions 1/1
92.31% Lines 12/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  1x 1x 1x   1x   6x 3x   3x 1x   2x 1x   1x 1x          
import { AbstractHandler } from './AbstractHandler';
import { BasicHandler } from './BasicHandler';
import { DigestHandler } from './DigestHandler';
import { NegotiateHandler } from './NegotiateHandler';
 
export class HandlerFactory {
  static instantiate(authenticationType: string): AbstractHandler {
    if (authenticationType === 'Negotiate') {
      return new NegotiateHandler();
    }
    if (authenticationType === 'NTLM') {
      return new NegotiateHandler('NTLM');
    }
    if (authenticationType === 'Basic') {
      return new BasicHandler();
    }
    Eif (authenticationType === 'Digest') {
      return new DigestHandler();
    }
    throw new Error('Cannot handle this authentication method');
  }
}