Skip to content

Commit

Permalink
fix: add InsecureCredentials to address issue in Cloud Spanner emulat…
Browse files Browse the repository at this point in the history
…or (#5224)
  • Loading branch information
HannahShiSFB authored May 2, 2022
1 parent eac417a commit 45a7643
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/EmulatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ private function emulatorGapicConfig($emulatorHost)
'credentials' => \Grpc\ChannelCredentials::createInsecure()
]
]
]
],
'credentials' => new InsecureCredentialsWrapper(),
];
}
/**
Expand Down
36 changes: 36 additions & 0 deletions src/InsecureCredentialsWrapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* Copyright 2022 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Google\Cloud\Core;

use Google\ApiCore\CredentialsWrapper;

/**
* For connect to emulator.
*/
class InsecureCredentialsWrapper extends CredentialsWrapper
{
public function __construct()
{
}

public function getAuthorizationHeaderCallback($audience = null)
{
return null;
}
}

0 comments on commit 45a7643

Please sign in to comment.