-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verifier Refactor for Multi-tenant Configs (#182)
- Loading branch information
Showing
11 changed files
with
148 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Auth/OAuth2/TokenVerifier/Contract/TokenVerifierInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Northwestern\SysDev\SOA\Auth\OAuth2\TokenVerifier\Contract; | ||
|
||
use Lcobucci\JWT\UnencryptedToken; | ||
|
||
interface TokenVerifierInterface | ||
{ | ||
public function parseAndVerify(string $jwt): UnencryptedToken; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Auth/OAuth2/TokenVerifier/MultiTenantAzureTokenVerifier.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Northwestern\SysDev\SOA\Auth\OAuth2\TokenVerifier; | ||
|
||
use Northwestern\SysDev\SOA\Auth\OAuth2\TokenVerifier\Contract\AbstractAzureTokenVerifier; | ||
use Northwestern\SysDev\SOA\Auth\OAuth2\TokenVerifier\Contract\TokenVerifierInterface; | ||
|
||
class MultiTenantAzureTokenVerifier extends AbstractAzureTokenVerifier implements TokenVerifierInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* | ||
* No additional verifications are necessary. | ||
*/ | ||
protected function additionalTokenConstraints(): array | ||
{ | ||
return []; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Auth/OAuth2/TokenVerifier/NorthwesternAzureTokenVerifier.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Northwestern\SysDev\SOA\Auth\OAuth2\TokenVerifier; | ||
|
||
use Lcobucci\JWT\Validation\Constraint\IssuedBy; | ||
use Northwestern\SysDev\SOA\Auth\OAuth2\TokenVerifier\Contract\AbstractAzureTokenVerifier; | ||
use Northwestern\SysDev\SOA\Auth\OAuth2\TokenVerifier\Contract\TokenVerifierInterface; | ||
|
||
class NorthwesternAzureTokenVerifier extends AbstractAzureTokenVerifier implements TokenVerifierInterface | ||
{ | ||
/** @var string UUID for the Northwestern Azure tenant */ | ||
public const ISSUER = 'https://login.microsoftonline.com/7d76d361-8277-4708-a477-64e8366cd1bc/v2.0'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* Checks the token was issued by the Northwestern Azure tenant. | ||
*/ | ||
protected function additionalTokenConstraints(): array | ||
{ | ||
return [ | ||
new IssuedBy(self::ISSUER), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters