thephpleague / oauth2-server

A spec compliant, secure by default PHP OAuth 2.0 Server
https://oauth2.thephpleague.com
MIT License
6.51k stars 1.12k forks source link

Simplifies `Bearer` regex #1238

Closed donatj closed 3 years ago

donatj commented 3 years ago

(?:\s+)? is just \s* but harder

eugene-borovov commented 3 years ago

Regular expressions are not needed here.

$jwt = \trim($header[0] ?? '');
$jwt = \strpos($jwt, 'Bearer') === 0 ? \trim(\substr($jwt, 6)) : $jwt;
Sephster commented 3 years ago

Looks good to me. Thanks @donatj