Hi,
I'm working on an Asp .Net Core 2.0 application that I am deploying to Predix. I want to use UAA to authenticate users with my application.
Has anyone any samples of how this is achieved with Asp .Net Core?
Thanks, Jeremy
Answer by jhorgan@lanner.com · Oct 13, 2017 at 03:52 AM
Thanks Tom,
Haven't managed to find anything on the forum.
I'm using the following but getting the following error: System.InvalidOperationException: IDX10803: Unable to obtain configuration from: 'https://.predix-uaa.run.aws-usw02-pr.ice.predix.io/.well-known/openid-configuration'.
I privately checked with Andrzej (https://forum.predix.io/questions/23629/aspnet-core-openid-connect-ssl.html) who also mentioned that in the last few weeks, his configuration has stopped too.
Does Predix UAA work with Asp .Net Core 2.0?
Regards, Jeremy
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.Authority = "https://<uaa-guid>.predix-uaa.run.aws-usw02-pr.ice.predix.io";
options.RequireHttpsMetadata = true;
options.ClientId = "login_client_id";
options.ClientSecret = "password";
options.ResponseType = OpenIdConnectResponseType.IdToken;
options.SaveTokens = true;
options.SignInScheme = "Cookies";
});
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Error");
}
// Ahead of Mvc middleware
app.UseAuthentication();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
}
About 3-4 weeks ago they started requiring that Redirect urls be listed in the Client Id entry. If you use the Predix Dashboard you need to ensure you an entry containing the redirect uri of where the browser gets redirected back to your app, after login.
That might explain why Andrzej's app stopped working.
It's not clear what grant-type you are using.
UAA is just REST apis. So if you get the URL, the Headers, the Body or QueryParameters and the UAA data set up correct, it'll work.
Answer by Tom Turner · Oct 11, 2017 at 02:10 PM
No official examples. But search the Forum, I recall some postings in the past.
Predix-UAA service returning 500 response 4 Answers
Unable to set redirect URI for hello world application 6 Answers
Explanation about UAA service 1 Answer
Getting uaa token as a string in predix seed? 2 Answers
Shared UAA integrate with RESTful API 5 Answers