Rystem.Authentication.Social
6.2.0
See the version list below for details.
dotnet add package Rystem.Authentication.Social --version 6.2.0
NuGet\Install-Package Rystem.Authentication.Social -Version 6.2.0
<PackageReference Include="Rystem.Authentication.Social" Version="6.2.0" />
paket add Rystem.Authentication.Social --version 6.2.0
#r "nuget: Rystem.Authentication.Social, 6.2.0"
// Install Rystem.Authentication.Social as a Cake Addin #addin nuget:?package=Rystem.Authentication.Social&version=6.2.0 // Install Rystem.Authentication.Social as a Cake Tool #tool nuget:?package=Rystem.Authentication.Social&version=6.2.0
What is Rystem?
Rystem.Authentication.Social
This project would be a super project to help the api creator to have fast api behind business interfaces and services dispatched through dependency injection.
How to use it
You need to configure the social information and token settings, for instance the duration of your token.
builder.Services.AddSocialLogin(x =>
{
x.Google.ClientId = builder.Configuration["SocialLogin:Google:ClientId"];
x.Google.ClientSecret = builder.Configuration["SocialLogin:Google:ClientSecret"];
x.Google.RedirectDomain = builder.Configuration["SocialLogin:Google:RedirectDomain"];
x.Microsoft.ClientId = builder.Configuration["SocialLogin:Microsoft:ClientId"];
x.Microsoft.ClientSecret = builder.Configuration["SocialLogin:Microsoft:ClientSecret"];
x.Microsoft.RedirectDomain = builder.Configuration["SocialLogin:Microsoft:RedirectDomain"];
x.Facebook.ClientId = builder.Configuration["SocialLogin:Facebook:ClientId"];
x.Facebook.ClientSecret = builder.Configuration["SocialLogin:Facebook:ClientSecret"];
x.Facebook.RedirectDomain = builder.Configuration["SocialLogin:Facebook:RedirectDomain"];
},
x =>
{
x.BearerTokenExpiration = TimeSpan.FromHours(1);
x.RefreshTokenExpiration = TimeSpan.FromDays(10);
});
You need to add in the app builder section the endpoints
app.UseSocialLoginEndpoints();
You can add your provider for user
builder.Services.AddSocialUserProvider<SocialUserProvider>();
SocialUserProvider is a ISocialUserProvider, to call for instance a database or storage to fetch the information about the user with social username/email.
internal sealed class SocialUserProvider : ISocialUserProvider
{
public Task<SocialUser> GetAsync(string username, IEnumerable<Claim> claims, CancellationToken cancellationToken)
{
return Task.FromResult(new SuperSocialUser
{
Username = $"a {username}",
Email = username
} as SocialUser);
}
public async IAsyncEnumerable<Claim> GetClaimsAsync(string? username, CancellationToken cancellationToken)
{
await Task.CompletedTask;
yield return new Claim(ClaimTypes.Name, username!);
yield return new Claim(ClaimTypes.Upn, "something");
}
}
public sealed class SuperSocialUser : SocialUser
{
public string Email { get; set; }
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Google.Apis.Auth (>= 1.68.0)
- Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 8.1.2)
- Microsoft.IdentityModel.Tokens (>= 8.1.2)
- Rystem.Authentication.Social.Abstractions (>= 6.2.0)
- Rystem.DependencyInjection (>= 6.2.0)
- System.IdentityModel.Tokens.Jwt (>= 8.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.0.3 | 0 | 12/22/2024 |
9.0.2 | 25 | 12/21/2024 |
9.0.1 | 544 | 12/21/2024 |
9.0.0 | 172,955 | 11/16/2024 |
9.0.0-rc.1 | 71 | 10/18/2024 |
6.2.0 | 219,030 | 10/9/2024 |
6.1.1 | 104 | 10/9/2024 |
6.1.0 | 47,910 | 9/29/2024 |
6.0.24 | 147 | 9/11/2024 |
6.0.23 | 340,008 | 7/18/2024 |
6.0.21 | 128 | 6/18/2024 |
6.0.20 | 727,760 | 6/16/2024 |
6.0.19 | 30,362 | 6/14/2024 |
6.0.18 | 106 | 6/14/2024 |
6.0.17 | 115 | 6/14/2024 |
6.0.16 | 49,978 | 6/10/2024 |
6.0.15 | 112 | 6/9/2024 |
6.0.14 | 94,255 | 5/24/2024 |
6.0.13 | 116 | 5/23/2024 |
6.0.12 | 96 | 5/23/2024 |
6.0.11 | 124 | 5/20/2024 |
6.0.9 | 131 | 5/20/2024 |
6.0.7 | 116 | 5/18/2024 |
6.0.6 | 118 | 5/10/2024 |
6.0.5 | 95 | 5/10/2024 |
6.0.4 | 549,728 | 4/3/2024 |
6.0.3 | 156 | 3/25/2024 |
6.0.2 | 166 | 3/11/2024 |
6.0.1 | 176 | 3/8/2024 |
6.0.0 | 508 | 11/21/2023 |
6.0.0-rc.6 | 78 | 11/9/2023 |