mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 13:09:44 +05:30
Updated .gitignore and .gitattributes
This commit is contained in:
parent
324b6db5e6
commit
171be1c422
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1,5 +1,4 @@
|
||||
tests/ export-ignore
|
||||
phpunit.xml export-ignore
|
||||
build.xml export-ignore
|
||||
test export-ignore
|
||||
.travis.yml export-ignore
|
||||
.scrutinizer.yml export-ignore
|
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,15 +1,3 @@
|
||||
/vendor
|
||||
/composer.lock
|
||||
/build
|
||||
/docs
|
||||
/testing
|
||||
/examples/relational/vendor
|
||||
/examples/relational/config/oauth2.sqlite3
|
||||
/examples/nosql/vendor
|
||||
/examples/nosql/config/oauth2.sqlite3
|
||||
/examples/relational/composer.lock
|
||||
/tests/codecept/tests/_log
|
||||
oauth2-server.paw
|
||||
/output_*/
|
||||
/_site
|
||||
.idea
|
@ -11,9 +11,10 @@
|
||||
|
||||
namespace League\OAuth2\Server\TokenTypes;
|
||||
|
||||
use Period\Period;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class Bearer extends AbstractTokenType
|
||||
class BearerTokenType extends AbstractTokenType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -21,9 +22,12 @@ class Bearer extends AbstractTokenType
|
||||
public function generateResponse()
|
||||
{
|
||||
$return = [
|
||||
'access_token' => $this->getParam('access_token'),
|
||||
'access_token' => $this->accessToken->getIdentifier(),
|
||||
'token_type' => 'Bearer',
|
||||
'expires_in' => $this->getParam('expires_in'),
|
||||
'expires_in' => (new Period(
|
||||
new \DateTime(),
|
||||
$this->accessToken->getExpiryDateTime())
|
||||
)->getTimestampInterval(),
|
||||
];
|
||||
|
||||
if (!is_null($this->getParam('refresh_token'))) {
|
||||
@ -41,6 +45,8 @@ class Bearer extends AbstractTokenType
|
||||
$header = $request->headers->get('Authorization');
|
||||
$accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $header));
|
||||
|
||||
// ^(?:\s+)?Bearer\s([a-zA-Z0-9-._~+/=]*)
|
||||
|
||||
return ($accessToken === 'Bearer') ? '' : $accessToken;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user