ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ProcessorBuilder.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\Assertion;
4 
24 use SAML2\Response;
26 
35 {
36  public static function build(
37  LoggerInterface $logger,
38  Validator $signatureValidator,
39  Destination $currentDestination,
40  IdentityProvider $identityProvider,
41  ServiceProvider $serviceProvider,
43  ) {
44  $keyloader = new PrivateKeyLoader();
45  $decrypter = new Decrypter($logger, $identityProvider, $serviceProvider, $keyloader);
46  $assertionValidator = self::createAssertionValidator($identityProvider, $serviceProvider);
47  $subjectConfirmationValidator = self::createSubjectConfirmationValidator(
48  $identityProvider,
49  $serviceProvider,
50  $currentDestination,
51  $response
52  );
53 
54  $transformerChain = self::createAssertionTransformerChain(
55  $logger,
56  $keyloader,
57  $identityProvider,
58  $serviceProvider
59  );
60 
61  return new Processor(
62  $decrypter,
63  $signatureValidator,
64  $assertionValidator,
65  $subjectConfirmationValidator,
66  $transformerChain,
67  $identityProvider,
68  $logger
69  );
70  }
71 
72  private static function createAssertionValidator(
73  IdentityProvider $identityProvider,
74  ServiceProvider $serviceProvider
75  ) {
76  $validator = new AssertionValidator($identityProvider, $serviceProvider);
77  $validator->addConstraintValidator(new NotBefore());
78  $validator->addConstraintValidator(new NotOnOrAfter());
79  $validator->addConstraintValidator(new SessionNotOnOrAfter());
80  $validator->addConstraintValidator(new SpIsValidAudience());
81 
82  return $validator;
83  }
84 
85  private static function createSubjectConfirmationValidator(
86  IdentityProvider $identityProvider,
87  ServiceProvider $serviceProvider,
88  Destination $currentDestination,
90  ) {
91  $validator = new SubjectConfirmationValidator($identityProvider, $serviceProvider);
92  $validator->addConstraintValidator(
94  );
95  $validator->addConstraintValidator(
97  );
98  $validator->addConstraintValidator(
100  );
101  $validator->addConstraintValidator(
103  $currentDestination
104  )
105  );
106  $validator->addConstraintValidator(
108  $response
109  )
110  );
111 
112  return $validator;
113  }
114 
115  private static function createAssertionTransformerChain(
116  LoggerInterface $logger,
117  PrivateKeyLoader $keyloader,
118  IdentityProvider $identityProvider,
119  ServiceProvider $serviceProvider
120  ) {
121  $chain = new TransformerChain($identityProvider, $serviceProvider);
122  $chain->addTransformerStep(new DecodeBase64Transformer());
123  $chain->addTransformerStep(
124  new NameIdDecryptionTransformer($logger, $keyloader)
125  );
126 
127  return $chain;
128  }
129 }
(PHPMD.CouplingBetweenObjects) - due to all the named exceptions
Definition: Processor.php:21
Basic configuration wrapper.
Basic Configuration Wrapper.
static build(LoggerInterface $logger, Validator $signatureValidator, Destination $currentDestination, IdentityProvider $identityProvider, ServiceProvider $serviceProvider, Response $response)
Simple Builder that allows to build a new Assertion Processor.
Describes a logger instance.
$sc SubjectConfirmationData NotOnOrAfter
Value Object representing the current destination.
Definition: Destination.php:10
Signature Validator.
Definition: Validator.php:14
static createAssertionTransformerChain(LoggerInterface $logger, PrivateKeyLoader $keyloader, IdentityProvider $identityProvider, ServiceProvider $serviceProvider)
$response
static createAssertionValidator(IdentityProvider $identityProvider, ServiceProvider $serviceProvider)
static createSubjectConfirmationValidator(IdentityProvider $identityProvider, ServiceProvider $serviceProvider, Destination $currentDestination, Response $response)