Comments (4)
Have you also added the appropriate middlewares (and in the right order) like in the sample application?
AspNet.Security.OpenId.Providers/samples/Mvc.Client/Startup.cs
Lines 57 to 69 in f5dde16
from aspnet.security.openid.providers.
Closing, as I believe your issue was caused by a missing middleware (typically, app.UseAuthentication()
).
from aspnet.security.openid.providers.
Hi, i have to re-open issue.
Now i have Kestrel Server, fully configured with your tips. Problem is (propably) that im using Nginx reverse proxy, and it begins again:
My configuration:
Startup:
readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
private void CheckSameSite(HttpContext httpContext, CookieOptions options)
{
if (options.SameSite == SameSiteMode.None)
{
var userAgent = httpContext.Request.Headers["User-Agent"].ToString();
options.SameSite = (SameSiteMode)(-1);
}
}
public void ConfigureServices(IServiceCollection services)
{
//services.AddGrpc();
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.LoginPath = "/login";
options.LogoutPath = "/signout";
})
.AddOpenId("Orange", "Orange", options =>
{
options.Authority = new Uri("https://openid.orange.fr/");
options.CallbackPath = "/signin-orange";
})
.AddOpenId("StackExchange", "StackExchange", options =>
{
options.Authority = new Uri("https://openid.stackexchange.com/");
options.CallbackPath = "/signin-stackexchange";
})
.AddOpenId("Intuit", "Intuit", options =>
{
options.CallbackPath = "/signin-intuit";
options.Configuration = new OpenIdAuthenticationConfiguration
{
AuthenticationEndpoint = "https://openid.intuit.com/OpenId/Provider"
};
})
.AddSteam();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
services.AddLogging();
services.AddCors(options =>
{
options.AddPolicy(MyAllowSpecificOrigins,
builder =>
{
builder.WithOrigins("*")
.AllowAnyHeader()
.AllowAnyOrigin()
.AllowAnyMethod();
});
});
services.Configure<CookiePolicyOptions>(options =>
{
options.MinimumSameSitePolicy = (SameSiteMode)(-1);
options.OnAppendCookie = cookieContext =>
CheckSameSite(cookieContext.Context, cookieContext.CookieOptions);
options.OnDeleteCookie = cookieContext =>
CheckSameSite(cookieContext.Context, cookieContext.CookieOptions);
});
}
public void Configure(IApplicationBuilder app, ILoggerFactory logger)
{
logger.CreateLogger("Logging");
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
});
app.Use((context, next) =>
{
context.Response.Headers.Add("Access-control-allow-headers", "Content-Type, Accept, X-Requested-With, method");
context.Response.Headers.Add("Access-control-allow-methods", "GET, POST, DELETE, PUT, OPTIONS, HEAD");
context.Response.Headers.Add("Access-control-allow-origin", "*");
context.Response.Headers.Add("Access-control-allow-credentials", "true");
return next.Invoke();
});
app.UseCors(option => option.WithHeaders("accept", "content-type", "origin"));
app.UseCookiePolicy();
app.UseCors(MyAllowSpecificOrigins);
app.UseHsts();
app.UseHttpsRedirection();
}
}
Program.cs
var host = new WebHostBuilder()
.UseKestrel()
.UseUrls($"{env_config.KestrelURL}")
.UseStartup<Startup>()
.ConfigureLogging(l =>
{
l.ClearProviders();
l.AddConsole();
})
.Build();
If user is Logged into steam redirection after taking SteamId works fine, but if user has to provide password, or confirm "Continue as xxxx" app redirecting him to 127.0.0.1:50000.
NGinx listening to 50000 on localhost, and proxing it to subdomain "secure.example.com".
from aspnet.security.openid.providers.
Have you configured nginx and/or Kestrel appropriately to forward on the host header and to be a trusted proxy for headers like x-forwarded-for
and x-forwarded-proto
?
from aspnet.security.openid.providers.
Related Issues (20)
- How to use options pattern in service registration? HOT 2
- Newtonsoft Json assembly manifest mismatch? HOT 2
- [Question] How to get the user's Steam ID HOT 3
- [Question] How to get the user profile object after authentication HOT 1
- CallbackPaths not defined HOT 2
- Blazor Wasm + Web API -> how to return Steam details to Blazor WASM HOT 1
- Blazor Server app doesn't find/execute the login endpoint when tested outside of Visual Studio HOT 1
- ASP.NET Core 6 Support HOT 1
- ASP.NET Core 7 Support HOT 1
- Is there any way I can login to asp.net using an API using a steam token HOT 1
- Issues trying to get the AddSteam command to work with .NET 7 Angular SPA template HOT 2
- Key value parsing in `VerifyAssertionAsync` is not strictly correct HOT 1
- 'HttpContext' does not contain a definition for 'GetExternalProvidersAsync' or for 'IsProviderSupportedAsync' HOT 1
- ASP.NET Core 8 Support HOT 1
- Can I issue my own JWT token when signing in user? HOT 1
- Authority URL works only on localhost. HOT 1
- Antiforgery issue when hosted in AWS ECS HOT 3
- sgID provider HOT 1
- ASP.NET 5 Support HOT 2
- Steam sign in works after second try HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspnet.security.openid.providers.