@@ -24,6 +24,16 @@ class FilterScopes extends ProcessingFilter
2424 'eduPersonPrincipalName ' ,
2525 ];
2626
27+ /**
28+ * Whether to allow values without a scope.
29+ *
30+ * - true = keep non-scoped values (backwards-compatible default)
31+ * - false = remove non-scoped values
32+ *
33+ * @var bool
34+ */
35+ private bool $ allowNonScoped = true ;
36+
2737
2838 /**
2939 * Constructor for the processing filter.
@@ -38,6 +48,10 @@ public function __construct(array &$config, $reserved)
3848 if (array_key_exists ('attributes ' , $ config ) && !empty ($ config ['attributes ' ])) {
3949 $ this ->scopedAttributes = $ config ['attributes ' ];
4050 }
51+
52+ if (\array_key_exists ('allowNonScoped ' , $ config ) && \is_bool ($ config ['allowNonScoped ' ])) {
53+ $ this ->allowNonScoped = $ config ['allowNonScoped ' ];
54+ }
4155 }
4256
4357
@@ -69,8 +83,10 @@ public function process(array &$state): void
6983 foreach ($ values as $ value ) {
7084 @list (, $ scope ) = explode ('@ ' , $ value , 2 );
7185 if ($ scope === null ) {
72- $ newValues [] = $ value ;
73- continue ; // there's no scope
86+ if ($ this ->allowNonScoped ) {
87+ $ newValues [] = $ value ; // there's no scope, but keep as-is
88+ }
89+ continue ;
7490 }
7591
7692 if (in_array ($ scope , $ validScopes , true )) {
0 commit comments