-
Notifications
You must be signed in to change notification settings - Fork 862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service specific endpoints don't work with SSO profiles #3538
Comments
Hello @drjaydenm, Thank you for reporting the issue. I am able to reproduce the scenario where the Service specific endpoint doesn't work with SSO profiles. Below is the minimal code sample (ASP.NET MVC web app) and configuration used for the same. Program.cs:using Amazon.SQS;
using Amazon.SSO;
namespace SSO_Issue
{
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
builder.Services.AddDefaultAWSOptions(builder.Configuration.GetAWSOptions());
builder.Services.AddAWSService<IAmazonSQS>();
builder.Services.AddAWSService<IAmazonSSO>();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Service/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Service}/{action=Index}/{id?}");
app.Run();
}
}
} ServiceController.cs:using Amazon.SQS;
using Microsoft.AspNetCore.Mvc;
using SSO_Issue.Models;
using System.Diagnostics;
namespace SSO_Issue.Controllers
{
public class ServiceController : Controller
{
private IAmazonSQS SQSClient { get; set; }
public ServiceController(IAmazonSQS sqsClient)
{
this.SQSClient = sqsClient;
}
public async Task<IActionResult> Index()
{
string queueName = "MyQueueName";
var response = await SQSClient.GetQueueUrlAsync(queueName);
string queueUrl = response.QueueUrl;
Console.WriteLine($"The URL for {queueName} is: {response.QueueUrl}");
this.ViewBag.QueueUrl = queueUrl;
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
} Index.cshtml:@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">SSO Issue page</h1>
QueueUrl: @ViewBag.QueueUrl
</div> appsettings.json:{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"AWS": {
"Region": "us-east-1",
"Profile": "app-dev"
}
} aws config file:
Packages used:
As you mentioned, I can also confirm that setting the service endpoint url works with the default profile. I will review this issue with the .NET SDK team to further investigate and root cause. Regards, |
Describe the bug
I'm seeing an issue where specifying service specific endpoints as per the documentation is not working when using a profile with SSO.
Regression Issue
Expected Behavior
Service specific configuration works correctly with SSO profiles.
Current Behavior
Service specific configuration like endpoint URL's aren't available to the client services (i.e. SQS) when setup on a profile using SSO.
Adding the service specific configuration to the
default
profile however works correctly.Reproduction Steps
~/.aws/config
file:appsettings.json
file:Program.cs
file:Possible Solution
I've stepped through the SDK a bit and it seems like the
SharedCredentialsFile
for theapp-dev
profile initially loads (which has theservices
NestedProperties
available), but then gets swapped to thedefault
profile further down the line by the time it makes its way to the SQS client.Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Targeted .NET Platform
.NET 8
Operating System and version
Windows 11
The text was updated successfully, but these errors were encountered: