/// <summary> /// Exchange Username, Password and Scope an ACR Access Token /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='service'> /// Indicates the name of your Azure container registry. /// </param> /// <param name='scope'> /// Expected to be a valid scope, and can be specified more than once for /// multiple scope requests. You can obtain this from the Www-Authenticate /// response header from the challenge. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <AccessToken> GetFromLoginAsync(this IAccessTokensOperations operations, string service, string scope, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetFromLoginWithHttpMessagesAsync(service, scope, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { V2Support = new V2SupportOperations(this); Manifests = new ManifestsOperations(this); Blob = new BlobOperations(this); Repository = new RepositoryOperations(this); Tag = new TagOperations(this); RefreshTokens = new RefreshTokensOperations(this); AccessTokens = new AccessTokensOperations(this); BaseUri = "{url}"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); }