feat: add some fediverse authentication code

* create applications on instances
* generate authorize URLs
* exchange oauth code for token and user info (untested)
* recreate mastodon app on authentication failure
This commit is contained in:
sam 2024-10-06 15:34:31 +02:00
parent a4ca0902a3
commit 0077a165b5
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
8 changed files with 497 additions and 0 deletions

View file

@ -1,3 +1,5 @@
using NodaTime;
namespace Foxnouns.Backend.Database.Models;
public class FediverseApplication : BaseModel
@ -6,6 +8,10 @@ public class FediverseApplication : BaseModel
public required string ClientId { get; set; }
public required string ClientSecret { get; set; }
public required FediverseInstanceType InstanceType { get; set; }
// These are for ensuring the application is still valid.
public string? AccessToken { get; set; }
public Instant? TokenValidUntil { get; set; }
}
public enum FediverseInstanceType