Updated .gitignore and .gitattributes

This commit is contained in:
Alex Bilbie 2015-04-05 13:59:38 +01:00
parent 324b6db5e6
commit 171be1c422
6 changed files with 12 additions and 19 deletions

3
.gitattributes vendored
View File

@ -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
View File

@ -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

View File

@ -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;
}
}