@@ -73,7 +73,7 @@ protected function configure() {
7373 ->addOption ('mapping-quota ' , null , InputOption::VALUE_OPTIONAL , 'Attribute mapping of the quota ' )
7474 ->addOption ('mapping-uid ' , null , InputOption::VALUE_OPTIONAL , 'Attribute mapping of the user id ' )
7575 ->addOption ('extra-claims ' , null , InputOption::VALUE_OPTIONAL , 'Extra claims to request when getting tokens ' )
76-
76+ -> addOption ( ' bearersecret ' , ' bs ' , InputOption:: VALUE_OPTIONAL , ' Telekom bearer token requires a different client secret for bearer tokens ' )
7777 ->addOption (
7878 'output ' ,
7979 null ,
@@ -100,11 +100,18 @@ protected function execute(InputInterface $input, OutputInterface $output) {
100100 return $ this ->listProviders ($ input , $ output );
101101 }
102102
103+ // bearersecret is usually base64 encoded, but SAM delivers it non-encoded
104+ // by default; so always encode/decode for this field
105+ $ bearersecret = $ input ->getOption ('bearersecret ' );
106+ if ($ bearersecret !== null ) {
107+ $ bearersecret = $ this ->crypto ->encrypt (\Base64Url \Base64Url::encode ($ bearersecret ));
108+ }
109+
103110 // check if any option for updating is provided
104111 $ updateOptions = array_filter ($ input ->getOptions (), static function ($ value , $ option ) {
105112 return in_array ($ option , [
106113 'identifier ' , 'clientid ' , 'clientsecret ' , 'discoveryuri ' ,
107- 'scope ' , 'unique-uid ' , 'check-bearer ' ,
114+ 'scope ' , 'unique-uid ' , 'check-bearer ' , ' bearersecret ' ,
108115 'mapping-uid ' , 'mapping-display-name ' , 'mapping-email ' , 'mapping-quota ' ,
109116 'extra-claims '
110117 ]) && $ value !== null ;
@@ -146,7 +153,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
146153 $ scope = $ scope ?? 'openid email profile ' ;
147154 }
148155 try {
149- $ provider = $ this ->providerMapper ->createOrUpdateProvider ($ identifier , $ clientid , $ clientsecret , $ discoveryuri , $ scope );
156+ $ provider = $ this ->providerMapper ->createOrUpdateProvider ($ identifier , $ clientid , $ clientsecret , $ discoveryuri , $ scope, $ bearersecret );
150157 // invalidate JWKS cache (even if it was just created)
151158 $ this ->providerService ->setSetting ($ provider ->getId (), ProviderService::SETTING_JWKS_CACHE , '' );
152159 $ this ->providerService ->setSetting ($ provider ->getId (), ProviderService::SETTING_JWKS_CACHE_TIMESTAMP , '' );
0 commit comments