ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
DecodeBase64Transformer.php
Go to the documentation of this file.
1 <?php
2 
4 
8 
9 class DecodeBase64Transformer implements
12 {
17 
19  {
20  $this->identityProvider = $identityProvider;
21  }
22 
23  public function transform(Assertion $assertion)
24  {
25  if (!$this->identityProvider->hasBase64EncodedAttributes()) {
26  return $assertion;
27  }
28 
29  $attributes = $assertion->getAttributes();
30  $keys = array_keys($attributes);
31  $decoded = array_map(array($this, 'decodeValue'), $attributes);
32 
33  $attributes = array_combine($keys, $decoded);
34 
35  $assertion->setAttributes($attributes);
36  }
37 
44  private function decodeValue($value)
45  {
46  $elements = explode('_', $value);
47  return array_map('base64_decode', $elements);
48  }
49 }
setAttributes(array $attributes)
Replace all attributes.
Definition: Assertion.php:1205
Basic configuration wrapper.
$keys
getAttributes()
Retrieve all attributes.
Definition: Assertion.php:1195
Create styles array
The data for the language used.
Interface for triggering setter injection.