ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DecodeBase64Transformer.php
Go to the documentation of this file.
1<?php
2
4
8
9class 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}
An exception for terminatinating execution or to throw for unit testing.
setAttributes(array $attributes)
Replace all attributes.
Definition: Assertion.php:1205
getAttributes()
Retrieve all attributes.
Definition: Assertion.php:1195
Basic configuration wrapper.
Interface for triggering setter injection.
$keys