Tim
Tim
Explore posts from servers
CC#
Created by Tim on 9/8/2024 in #help
Which package for asp.net middleware
it seems to work, thanks
9 replies
CC#
Created by Tim on 9/8/2024 in #help
Which package for asp.net middleware
yeah thats what i meant
9 replies
CC#
Created by Tim on 9/8/2024 in #help
Which package for asp.net middleware
Ah, the framework reference uses the build in stuff of the Web sdk?
9 replies
CC#
Created by Tim on 9/8/2024 in #help
Which package for asp.net middleware
Although it is deprecated?
9 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
And it works too but I'm now in a autentication loop
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
Yeah but how do I do that? I already have
c#
builder.Services.AddRazorPages(options =>
{
options.Conventions.AuthorizeFolder("/");
});
c#
builder.Services.AddRazorPages(options =>
{
options.Conventions.AuthorizeFolder("/");
});
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
But now I'm in an endless login loop
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
Somehow it does not work when protecting the page / but it works when protecting the folder /
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
I think it works now
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
I don't know what I should check with autorization anymore
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
From that I still think that I don't need autorization as the user has access to my whole app when the user has an account which is checked with authentication already
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
I followed the official docs in my first attempt
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
Because I found nothing good in the official docs
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
I got most from https://developer.okta.com/blog/2019/07/12/secure-your-aspnet-core-app-with-oauth but I also used various other ressources
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
1. My identity provider only redirects if the user has access to the application so I know, that the user has access to my app when the user gets to the fallback 2. So you mean I need Autorization too? How do I do that?
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
You answer with yes to a what-question?? Authentication is a way for me to send the user to a auth provider which tells me if the user hast access to my app when the login is successful
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
What should I do more?
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
But it still does not work when I try to access the root page
64 replies
CC#
Created by Tim on 8/18/2024 in #help
Authenticate with AspNet.Security.OAuth.Spotify
I did a second attempt today, but now with another OAuth Provider. I have the following code:
c#
using dotenv.net;
using Microsoft.AspNetCore.Authentication.Cookies;

var envVars = DotEnv.Read();
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages(options =>
{
options.Conventions.AuthorizePage("/");
});
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = "Authentik";
}).AddCookie(options =>
{
options.LoginPath = "/auth/login";
options.LogoutPath = "/auth/logout";
}).AddOAuth("Authentik", options =>
{
options.AuthorizationEndpoint = envVars["AUTHORIZATION_ENDPOINT"];
options.TokenEndpoint = envVars["TOKEN_ENDPOINT"];
options.UserInformationEndpoint = envVars["USER_INFORMATION_ENDPOINT"];
options.ClientId = envVars["CLIENT_ID"];
options.ClientSecret = envVars["CLIENT_SECRET"];
options.ClaimsIssuer = envVars["CLAIMS_ISSUER"];
options.CallbackPath = "/auth/callback";
});

var app = builder.Build();
app.UseAuthentication();
app.MapRazorPages();

app.Run();
c#
using dotenv.net;
using Microsoft.AspNetCore.Authentication.Cookies;

var envVars = DotEnv.Read();
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages(options =>
{
options.Conventions.AuthorizePage("/");
});
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = "Authentik";
}).AddCookie(options =>
{
options.LoginPath = "/auth/login";
options.LogoutPath = "/auth/logout";
}).AddOAuth("Authentik", options =>
{
options.AuthorizationEndpoint = envVars["AUTHORIZATION_ENDPOINT"];
options.TokenEndpoint = envVars["TOKEN_ENDPOINT"];
options.UserInformationEndpoint = envVars["USER_INFORMATION_ENDPOINT"];
options.ClientId = envVars["CLIENT_ID"];
options.ClientSecret = envVars["CLIENT_SECRET"];
options.ClaimsIssuer = envVars["CLAIMS_ISSUER"];
options.CallbackPath = "/auth/callback";
});

var app = builder.Build();
app.UseAuthentication();
app.MapRazorPages();

app.Run();
64 replies
CC#
Created by Tim on 8/17/2024 in #help
✅ WireGuard Wrapper
So I'll give the library a shot.
10 replies