/// <summary> /// Obtain token using the Application authentication token /// provider framework. /// </summary> /// <param name="resource"></param> /// <param name="scopes"></param> /// <returns></returns> public async Task <TokenResultModel> GetTokenForAsync(string resource, IEnumerable <string> scopes) { var token = await _provider.GetAccessTokenAsync(resource, _config?.AppSecret ?? _config?.TenantId); return(TokenResultModelEx.Parse(token)); }
/// <summary> /// Obtain token using the Application authentication token /// provider framework. /// </summary> /// <param name="resource"></param> /// <param name="scopes"></param> /// <returns></returns> public async Task <TokenResultModel> GetTokenForAsync(string resource, IEnumerable <string> scopes) { var token = await _provider.KeyVaultTokenCallback( _config.GetAuthorityUrl(), resource, scopes.FirstOrDefault()); return(TokenResultModelEx.Parse(token)); }
/// <inheritdoc/> public async Task <TokenResultModel> GetTokenForAsync(string resource, IEnumerable <string> scopes) { const string kAccessTokenKey = "access_token"; var token = await _ctx.HttpContext.GetTokenAsync(kAccessTokenKey); if (string.IsNullOrEmpty(token)) { return(null); } return(TokenResultModelEx.Parse(token)); }