Abdesol
Abdesol
CC#
Created by Abdesol on 10/12/2024 in #help
Using Azure ADB2C, new user claim is being sent on every sign in
This is the authentication schema I am using:
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
.AddOpenIdConnect(options =>
{
configuration.GetSection("AzureAdB2C").Bind(options);
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.ResponseType = "code";
options.SaveTokens = true;
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add(options.ClientId!);

options.Events = new OpenIdConnectEvents()
{
OnRedirectToIdentityProvider = context =>
{
if (context.Request.Path != "/account/sign-in")
{
var endpoint = context.HttpContext.GetEndpoint();
context.Response.StatusCode = endpoint != null
? StatusCodes.Status401Unauthorized
: StatusCodes.Status404NotFound;
context.HandleResponse();
}

return Task.CompletedTask;
}
};
});
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
.AddOpenIdConnect(options =>
{
configuration.GetSection("AzureAdB2C").Bind(options);
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.ResponseType = "code";
options.SaveTokens = true;
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add(options.ClientId!);

options.Events = new OpenIdConnectEvents()
{
OnRedirectToIdentityProvider = context =>
{
if (context.Request.Path != "/account/sign-in")
{
var endpoint = context.HttpContext.GetEndpoint();
context.Response.StatusCode = endpoint != null
? StatusCodes.Status401Unauthorized
: StatusCodes.Status404NotFound;
context.HandleResponse();
}

return Task.CompletedTask;
}
};
});
I tried tweaking the SaveTokens, SignInSchema and other attributes, but all of them result in some form of authentication and schema errors. I appreciate any idea or help around this. Thank you!
2 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
I am also logging in with the window's authentication on SSMS
20 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
Server=localhost; Database=database_name;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True;Integrated Security=True;
Server=localhost; Database=database_name;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True;Integrated Security=True;
This is what I am using
20 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
and it is not running on docker container.. it is just directly on my pc now
20 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
I am able to connect to it through SSMS
20 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
I am requesting the backup of the db to load it on my side to avoid all these issues. I hope this will fix it, but if not, I am cooked
20 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
yeah, they are expecting that. Do you think SQL Server might behave differently from system to system, or the way they are describing it will work just accidently somehow worked?
20 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
but after creating the db, manually, and giving my login the db owner and all the other permissions, I face this error:
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Table_Name'.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Table_Name'.
20 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
They said just run the project and it will create the database as well.
20 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
the problem was, when I call endpoints which need authorization, it used to redirect to idp
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
so, only /account/signin can redirect to idp
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
@TeBeCo
options.Events = new OpenIdConnectEvents()
{
OnRedirectToIdentityProvider = context =>
{
if (context.Request.Path != "/account/signin")
{
var endpoint = context.HttpContext.GetEndpoint();
context.Response.StatusCode = endpoint != null ? StatusCodes.Status401Unauthorized : StatusCodes.Status404NotFound;
context.HandleResponse();
}

return Task.CompletedTask;
}
};
options.Events = new OpenIdConnectEvents()
{
OnRedirectToIdentityProvider = context =>
{
if (context.Request.Path != "/account/signin")
{
var endpoint = context.HttpContext.GetEndpoint();
context.Response.StatusCode = endpoint != null ? StatusCodes.Status401Unauthorized : StatusCodes.Status404NotFound;
context.HandleResponse();
}

return Task.CompletedTask;
}
};
This was just what I was looking for and I made it
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
yeah
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
I am really not looking for branding now, and this is azure services learning and practicing project I am working on. I just wanna have the authority of the endpoints to my self :catsweat:
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
I wanna redirect users to azure ad b2c manually.
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
The first task will be to fix the issue of not going to my breakpoint of accounts controller etc..
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
Yeah. I have seen that, and I appreciate that, I think I need to carefully go through every basic thing in the docs first
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
oh, interesting. Thank you so much for pointing that out
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
but btw, what is the problem when I do random non existing endpoints it is redirecting to azure ad b2c?
71 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
okay, I think I understand now. I was also looking for ways to disable this
71 replies