forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
local fix for gcp plugin branch 2.11.1
Signed-off-by: fahadshamiinsta <fshami@netapp.com>
- Loading branch information
1 parent
6b1986e
commit ea23130
Showing
3 changed files
with
132 additions
and
29 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...cs/src/main/java/org/opensearch/repositories/gcs/GoogleApplicationDefaultCredentials.java
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,30 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.repositories.gcs; | ||
|
||
import com.google.auth.oauth2.GoogleCredentials; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.io.IOException; | ||
|
||
public class GoogleApplicationDefaultCredentials { | ||
private static final Logger logger = LogManager.getLogger(GoogleApplicationDefaultCredentials.class); | ||
|
||
public GoogleCredentials getApplicationDefaultCredentials() { | ||
GoogleCredentials credentials = null; | ||
try { | ||
credentials = SocketAccess.doPrivilegedIOException(GoogleCredentials::getApplicationDefault); | ||
} catch (IOException e) { | ||
logger.error("Failed to retrieve \"Application Default Credentials\"",e); | ||
} | ||
return credentials; | ||
} | ||
|
||
} |
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