Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/CODEOWNERS

This file was deleted.

36 changes: 0 additions & 36 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

7 changes: 0 additions & 7 deletions .github/ISSUE_TEMPLATE/support_request.md

This file was deleted.

2 changes: 0 additions & 2 deletions .github/conventional-commit-lint.yaml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**PLEASE READ THIS ENTIRE MESSAGE**

Hello, and thank you for your contribution! Please note that this repository is
a read-only split of `googleapis/google-cloud-php`. As such, we are
unable to accept pull requests to this repository.

We welcome your pull request and would be happy to consider it for inclusion in
our library if you follow these steps:

* Clone the parent client library repository:

```sh
$ git clone git@github.com:googleapis/google-cloud-php.git
```

* Move your changes into the correct location in that library. Library code
belongs in `Auth/src`, and tests in `Auth/tests`.

* Push the changes in a new branch to a fork, and open a new pull request
[here](https://github.com/googleapis/google-cloud-php).

Thanks again, and we look forward to seeing your proposed change!

The Google Cloud PHP team
4 changes: 0 additions & 4 deletions .github/release-please.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/release-trigger.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/lint.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/release.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/tests.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .repo-metadata.json

This file was deleted.

File renamed without changes.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Google Auth Library for PHP

<a href="https://cloud.google.com/php/docs/reference/auth/latest">Reference Docs</a>
* [API documentation](https://cloud.google.com/php/docs/reference/auth/latest)

**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any
support requests, bug reports, or development contributions should be directed to
that project.

## Description

Expand Down
10 changes: 9 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "library",
"description": "Google Auth Library for PHP",
"keywords": ["google", "oauth2", "authentication"],
"homepage": "https://github.com/google/google-auth-library-php",
"homepage": "https://github.com/googleapis/google-auth-library-php",
"license": "Apache-2.0",
"support": {
"docs": "https://cloud.google.com/php/docs/reference/auth/latest"
Expand Down Expand Up @@ -42,5 +42,13 @@
"psr-4": {
"Google\\Auth\\Tests\\": "tests"
}
},
"extra": {
"component": {
"id": "auth",
"target": "googleapis/google-auth-library-php.git",
"path": "Auth",
"entry": "README.md"
}
}
}
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ parameters:
- src
featureToggles:
disableRuntimeReflectionProvider: true
excludePaths:
- src/Cache/Item.php
6 changes: 0 additions & 6 deletions renovate.json

This file was deleted.

6 changes: 5 additions & 1 deletion src/ApplicationDefaultCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ public static function getDefaultLogger(): null|LoggerInterface
// Env Var is not true
if ($loggingFlag !== 'true') {
if ($loggingFlag !== 'false') {
trigger_error('The ' . self::SDK_DEBUG_ENV_VAR . ' is set, but it is set to another value than false or true. Logging is disabled');
trigger_error(
'The ' .
self::SDK_DEBUG_ENV_VAR .
' is set, but it is set to another value than false or true. Logging is disabled'
);
}

return null;
Expand Down
8 changes: 6 additions & 2 deletions src/Cache/FileSystemCacheItemPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public function __construct(string $path)
public function getItem(string $key): CacheItemInterface
{
if (!$this->validKey($key)) {
throw new InvalidArgumentException("The key '$key' is not valid. The key should follow the pattern |^[a-zA-Z0-9_\.! ]+$|");
throw new InvalidArgumentException(
'The key \'' . $key . '\' is not valid. The key should follow the pattern |^[a-zA-Z0-9_\.! ]+$|'
);
}

$item = new TypedItem($key);
Expand Down Expand Up @@ -166,7 +168,9 @@ public function clear(): bool
public function deleteItem(string $key): bool
{
if (!$this->validKey($key)) {
throw new InvalidArgumentException("The key '$key' is not valid. The key should follow the pattern |^[a-zA-Z0-9_\.! ]+$|");
throw new InvalidArgumentException(
'The key \'' . $key . '\' is not valid. The key should follow the pattern |^[a-zA-Z0-9_\.! ]+$|'
);
}

$itemPath = $this->cacheFilePath($key);
Expand Down
4 changes: 3 additions & 1 deletion src/CredentialSource/AwsNativeSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public function fetchSubjectToken(?callable $httpHandler = null): string

if (!$signingVars) {
if (!$this->securityCredentialsUrl) {
throw new \LogicException('Unable to get credentials from ENV, and no security credentials URL provided');
throw new \LogicException(
'Unable to get credentials from ENV, and no security credentials URL provided'
);
}
$signingVars = self::getSigningVarsFromUrl(
$httpHandler,
Expand Down
17 changes: 11 additions & 6 deletions src/CredentialSource/ExecutableSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,9 @@ public function fetchSubjectToken(?callable $httpHandler = null): string
*/
private function getCachedExecutableResponse(): ?array
{
if (
$this->outputFile
&& file_exists($this->outputFile)
&& !empty(trim($outputFileContents = (string) file_get_contents($this->outputFile)))
if ($this->outputFile &&
file_exists($this->outputFile) &&
!empty(trim($outputFileContents = (string) file_get_contents($this->outputFile)))
) {
try {
$executableResponse = $this->parseExecutableResponse($outputFileContents);
Expand Down Expand Up @@ -219,7 +218,11 @@ private function parseExecutableResponse(string $response): array
// Validate required fields for a successful response.
if ($executableResponse['success']) {
// Validate token type field.
$tokenTypes = [self::SAML_SUBJECT_TOKEN_TYPE, self::OIDC_SUBJECT_TOKEN_TYPE1, self::OIDC_SUBJECT_TOKEN_TYPE2];
$tokenTypes = [
self::SAML_SUBJECT_TOKEN_TYPE,
self::OIDC_SUBJECT_TOKEN_TYPE1,
self::OIDC_SUBJECT_TOKEN_TYPE2
];
if (!isset($executableResponse['token_type'])) {
throw new ExecutableResponseError(
'Executable response must contain a "token_type" field when successful'
Expand Down Expand Up @@ -263,7 +266,9 @@ private function parseExecutableResponse(string $response): array
throw new ExecutableResponseError('Executable response must contain a "code" field when unsuccessful.');
}
if (empty($executableResponse['message'])) {
throw new ExecutableResponseError('Executable response must contain a "message" field when unsuccessful.');
throw new ExecutableResponseError(
'Executable response must contain a "message" field when unsuccessful.'
);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/CredentialSource/FileSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class FileSource implements ExternalAccountCredentialSourceInterface
/**
* @param string $file The file to read the subject token from.
* @param string|null $format The format of the token in the file. Can be null or "json".
* @param string|null $subjectTokenFieldName The name of the field containing the token in the file. This is required
* when format is "json".
* @param string|null $subjectTokenFieldName The name of the field containing the token in the file.
* This is required when format is "json".
*/
public function __construct(
string $file,
Expand Down
4 changes: 2 additions & 2 deletions src/CredentialSource/UrlSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class UrlSource implements ExternalAccountCredentialSourceInterface
/**
* @param string $url The URL to fetch the subject token from.
* @param string|null $format The format of the token in the response. Can be null or "json".
* @param string|null $subjectTokenFieldName The name of the field containing the token in the response. This is required
* when format is "json".
* @param string|null $subjectTokenFieldName The name of the field containing the token in the response.
* This is required when format is "json".
* @param array<string, string|string[]>|null $headers Request headers to send in with the request to the URL.
*/
public function __construct(
Expand Down
3 changes: 1 addition & 2 deletions src/Credentials/ExternalAccountCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ private static function buildCredentialSource(array $jsonKey): ExternalAccountCr
);
}

if (
isset($credentialSource['environment_id'])
if (isset($credentialSource['environment_id'])
&& 1 === preg_match('/^aws(\d+)$/', $credentialSource['environment_id'], $matches)
) {
if ($matches[1] !== '1') {
Expand Down
3 changes: 1 addition & 2 deletions src/Credentials/ImpersonatedServiceAccountCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ public function __construct(
if (!array_key_exists('type', $jsonKey['source_credentials'])) {
throw new InvalidArgumentException('json key source credentials are missing the type field');
}
if (
$targetAudience !== null
if ($targetAudience !== null
&& $jsonKey['source_credentials']['type'] === 'service_account'
) {
// Service account tokens MUST request a scope, and as this token is only used to impersonate
Expand Down
Loading
Loading