C# 클래스 Google.PowerShell.Common.AuthenticateWithSdkCredentialsExecutor

OAuth 2.0 credential for accessing protected resources using an access token. This class will get the access token from "gcloud auth print-access-token".
상속: ICredential, IHttpExecuteInterceptor, IHttpUnsuccessfulResponseHandler
파일 보기 프로젝트 열기: GoogleCloudPlatform/google-cloud-powershell 1 사용 예제들

공개 메소드들

메소드 설명
GetAccessTokenForRequestAsync ( string authUri = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task
HandleResponseAsync ( Google.Apis.Http.HandleUnsuccessfulResponseArgs args ) : Task

Handles an abnormal response when sending a HTTP request. A simple rule must be followed, if you modify the request object in a way that the abnormal response can be resolved, you must return true.

Initialize ( Google.Apis.Http.ConfigurableHttpClient httpClient ) : void
InterceptAsync ( HttpRequestMessage request, CancellationToken taskCancellationToken ) : Task

Default implementation is to try to refresh the access token if there is no access token or if we are 1 minute away from expiration. If token server is unavailable, it will try to use the access token even if has expired. If successful, it will call IAccessMethod.Intercept.

RefreshTokenAsync ( CancellationToken taskCancellationToken ) : Task

Refreshes the token by calling to ActiveUserConfig.GetActiveUserToken

RevokeTokenAsync ( CancellationToken taskCancellationToken ) : Task

Asynchronously revokes the token by calling Google.Apis.Auth.OAuth2.Flows.IAuthorizationCodeFlow.RevokeTokenAsync.

메소드 상세

GetAccessTokenForRequestAsync() 공개 메소드

public GetAccessTokenForRequestAsync ( string authUri = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task
authUri string
cancellationToken System.Threading.CancellationToken
리턴 Task

HandleResponseAsync() 공개 메소드

Handles an abnormal response when sending a HTTP request. A simple rule must be followed, if you modify the request object in a way that the abnormal response can be resolved, you must return true.
public HandleResponseAsync ( Google.Apis.Http.HandleUnsuccessfulResponseArgs args ) : Task
args Google.Apis.Http.HandleUnsuccessfulResponseArgs
리턴 Task

Initialize() 공개 메소드

public Initialize ( Google.Apis.Http.ConfigurableHttpClient httpClient ) : void
httpClient Google.Apis.Http.ConfigurableHttpClient
리턴 void

InterceptAsync() 공개 메소드

Default implementation is to try to refresh the access token if there is no access token or if we are 1 minute away from expiration. If token server is unavailable, it will try to use the access token even if has expired. If successful, it will call IAccessMethod.Intercept.
public InterceptAsync ( HttpRequestMessage request, CancellationToken taskCancellationToken ) : Task
request System.Net.Http.HttpRequestMessage
taskCancellationToken System.Threading.CancellationToken
리턴 Task

RefreshTokenAsync() 공개 메소드

Refreshes the token by calling to ActiveUserConfig.GetActiveUserToken
public RefreshTokenAsync ( CancellationToken taskCancellationToken ) : Task
taskCancellationToken System.Threading.CancellationToken
리턴 Task

RevokeTokenAsync() 공개 메소드

Asynchronously revokes the token by calling Google.Apis.Auth.OAuth2.Flows.IAuthorizationCodeFlow.RevokeTokenAsync.
public RevokeTokenAsync ( CancellationToken taskCancellationToken ) : Task
taskCancellationToken System.Threading.CancellationToken Cancellation token to cancel an operation.
리턴 Task