Skip to content

Commit 88d87a7

Browse files
committed
Add Entity classes to be used with League\OAuth2\Server.
1 parent 228a8a4 commit 88d87a7

6 files changed

Lines changed: 108 additions & 0 deletions

File tree

src/Entity/AccessToken.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Auth\Entity;
4+
5+
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
6+
use League\OAuth2\Server\Entities\Traits\AccessTokenTrait;
7+
use League\OAuth2\Server\Entities\Traits\EntityTrait;
8+
use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;
9+
10+
class AccessToken implements AccessTokenEntityInterface
11+
{
12+
/*/ League\OAuth2\Server Traits /*/
13+
use AccessTokenTrait;
14+
use EntityTrait;
15+
use TokenEntityTrait;
16+
17+
/*/ Pdsinterop\Solid\Auth Traits /*/
18+
use ClientEntityTrait;
19+
}

src/Entity/AuthCode.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Auth\Entity;
4+
5+
use League\OAuth2\Server\Entities\AuthCodeEntityInterface;
6+
use League\OAuth2\Server\Entities\Traits\AuthCodeTrait;
7+
use League\OAuth2\Server\Entities\Traits\EntityTrait;
8+
use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;
9+
10+
class AuthCode implements AuthCodeEntityInterface
11+
{
12+
/*/ League\OAuth2\Server Traits /*/
13+
use AuthCodeTrait;
14+
use EntityTrait;
15+
use TokenEntityTrait;
16+
17+
/*/ Pdsinterop\Solid\Auth Traits /*/
18+
use ClientEntityTrait;
19+
}

src/Entity/Client.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Auth\Entity;
4+
5+
use League\OAuth2\Server\Entities\ClientEntityInterface;
6+
use League\OAuth2\Server\Entities\Traits\ClientTrait;
7+
use League\OAuth2\Server\Entities\Traits\EntityTrait;
8+
9+
class Client implements ClientEntityInterface
10+
{
11+
use ClientTrait;
12+
use EntityTrait;
13+
14+
/**
15+
* Client constructor.
16+
*
17+
* @param string|null $identifier
18+
* @param string|null $name
19+
* @param string[]|null $redirectUri
20+
* @param bool $isConfidential
21+
*/
22+
public function __construct(
23+
string $identifier = null,
24+
string $name = null,
25+
array $redirectUri = null,
26+
bool $isConfidential = false
27+
) {
28+
$this->isConfidential = $isConfidential;
29+
$this->name = $name;
30+
$this->redirectUri = $redirectUri;
31+
$this->setIdentifier($identifier);
32+
}
33+
}

src/Entity/RefreshToken.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Auth\Entity;
4+
5+
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
6+
use League\OAuth2\Server\Entities\Traits\EntityTrait;
7+
use League\OAuth2\Server\Entities\Traits\RefreshTokenTrait;
8+
9+
class RefreshToken implements RefreshTokenEntityInterface
10+
{
11+
use RefreshTokenTrait;
12+
use EntityTrait;
13+
}

src/Entity/Scope.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Auth\Entity;
4+
5+
use League\OAuth2\Server\Entities\ScopeEntityInterface;
6+
use League\OAuth2\Server\Entities\Traits\EntityTrait;
7+
use League\OAuth2\Server\Entities\Traits\ScopeTrait;
8+
9+
class Scope implements ScopeEntityInterface
10+
{
11+
use EntityTrait;
12+
use ScopeTrait;
13+
}

src/Entity/User.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Auth\Entity;
4+
5+
use League\OAuth2\Server\Entities\Traits\EntityTrait;
6+
use League\OAuth2\Server\Entities\UserEntityInterface;
7+
8+
class User implements UserEntityInterface
9+
{
10+
use EntityTrait;
11+
}

0 commit comments

Comments
 (0)