Skip to content

Commit

Permalink
Merge pull request #89 from microsoft/dev
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
SilasKenneth authored Jun 20, 2024
2 parents 2b2465a + 02c9e52 commit 49e739a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @ddyett @MichaelMainer @nikithauc @zengin @silaskenneth @Ndiritu @shemogumbe
* @microsoft/kiota-write
8 changes: 4 additions & 4 deletions .github/policies/resourceManagement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ configuration:
- isIssue
- isOpen
- hasLabel:
label: 'Needs: Author Feedback'
label: 'status:waiting-for-author-feedback'
- hasLabel:
label: 'Status: No Recent Activity'
- noActivitySince:
Expand All @@ -31,7 +31,7 @@ configuration:
- isIssue
- isOpen
- hasLabel:
label: 'Needs: Author Feedback'
label: 'status:waiting-for-author-feedback'
- noActivitySince:
days: 4
- isNotLabeledWith:
Expand Down Expand Up @@ -64,13 +64,13 @@ configuration:
- isActivitySender:
issueAuthor: True
- hasLabel:
label: 'Needs: Author Feedback'
label: 'status:waiting-for-author-feedback'
- isOpen
then:
- addLabel:
label: 'Needs: Attention :wave:'
- removeLabel:
label: 'Needs: Author Feedback'
label: 'status:waiting-for-author-feedback'
description:
- if:
- payloadType: Issues
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
uses: dependabot/fetch-metadata@v2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
php-versions: ['7.4', '8.0', '8.1', '8.2']
steps:
- name: Checkout
uses: actions/[email protected].1
uses: actions/[email protected].7
- name: Setup PHP and Xdebug for Code Coverage report
uses: shivammathur/setup-php@v2
with:
Expand Down
1 change: 1 addition & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Resources:
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support)
32 changes: 22 additions & 10 deletions src/Oauth/ProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,41 @@ class ProviderFactory
* Initialises a PHP League provider for the Microsoft Identity platform
* @param TokenRequestContext $tokenRequestContext
* @param array<string, object> $collaborators
* @param string $tokenServiceBaseUrl Base URL for the token and authorize endpoint. Defaults to
* @param string|null $tokenServiceBaseUrl Base URL for the token and authorize endpoint. Defaults to
* https://login.microsoftonline.com
* @param string $userInfoServiceBaseUrl Base URL for the user info endpoint. Defaults to
* @param string|null $userInfoServiceBaseUrl Base URL for the user info endpoint. Defaults to
* https://graph.microsoft.com
* @param array<string, string> $clientOptions Additional client options to pass to the underlying http client.
* @return GenericProvider
*/
public static function create(
TokenRequestContext $tokenRequestContext,
array $collaborators = [],
string $tokenServiceBaseUrl = 'https://login.microsoftonline.com',
string $userInfoServiceBaseUrl = 'https://graph.microsoft.com'
?string $tokenServiceBaseUrl = null,
?string $userInfoServiceBaseUrl = null,
array $clientOptions = []
): GenericProvider
{
if ($tokenServiceBaseUrl === null || empty(trim($tokenServiceBaseUrl))) {
$tokenServiceBaseUrl = 'https://login.microsoftonline.com';
}
if ($userInfoServiceBaseUrl === null || empty(trim($userInfoServiceBaseUrl))) {
$userInfoServiceBaseUrl = 'https://graph.microsoft.com';
}

$grantFactory = new GrantFactory();
// Add our custom grant type to the registry
$grantFactory->setGrant('urn:ietf:params:Oauth:grant-type:jwt-bearer', new OnBehalfOfGrant());

return new GenericProvider([
'urlAccessToken' => "$tokenServiceBaseUrl/{$tokenRequestContext->getTenantId()}/oauth2/v2.0/token",
'urlAuthorize' => "$tokenServiceBaseUrl/{$tokenRequestContext->getTenantId()}/oauth2/v2.0/authorize",
'urlResourceOwnerDetails' => "$userInfoServiceBaseUrl/oidc/userinfo",
'accessTokenResourceOwnerId' => 'id_token'
], $collaborators + [
$allOptions = array_merge(
[
'urlAccessToken' => "$tokenServiceBaseUrl/{$tokenRequestContext->getTenantId()}/oauth2/v2.0/token",
'urlAuthorize' => "$tokenServiceBaseUrl/{$tokenRequestContext->getTenantId()}/oauth2/v2.0/authorize",
'urlResourceOwnerDetails' => "$userInfoServiceBaseUrl/oidc/userinfo",
'accessTokenResourceOwnerId' => 'id_token'
], $clientOptions
);
return new GenericProvider($allOptions, $collaborators + [
'grantFactory' => $grantFactory
]);
}
Expand Down

0 comments on commit 49e739a

Please sign in to comment.