diff --git a/docs/kook.md b/docs/kook.md index b9e271a4c..c2dd846af 100644 --- a/docs/kook.md +++ b/docs/kook.md @@ -11,8 +11,8 @@ services.AddAuthentication(options => /* Auth configuration */) // The scope get_user_info is added by default // Please make sure the scope get_user_info is enabled in your KOOK developer center - // Hence, whether to add the scope get_user_info here manually is optional - // options.Scope.Add("get_user_info"); + // If you do not want to use the default scope indeed, try remove it by + // options.Scope.Remove("get_user_info"); }); ``` diff --git a/src/AspNet.Security.OAuth.Kook/AspNet.Security.OAuth.Kook.csproj b/src/AspNet.Security.OAuth.Kook/AspNet.Security.OAuth.Kook.csproj index d7785fb1d..bb6b7c60e 100644 --- a/src/AspNet.Security.OAuth.Kook/AspNet.Security.OAuth.Kook.csproj +++ b/src/AspNet.Security.OAuth.Kook/AspNet.Security.OAuth.Kook.csproj @@ -7,10 +7,11 @@ true + 7.0.1 - ASP.NET Core security middleware enabling Kook authentication. + ASP.NET Core security middleware enabling KOOK authentication. Gehongyan aspnetcore;authentication;kaiheila;kook;kookapp;oauth;security diff --git a/src/AspNet.Security.OAuth.Kook/KookAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Kook/KookAuthenticationConstants.cs index 20b8a6aaf..84be38775 100644 --- a/src/AspNet.Security.OAuth.Kook/KookAuthenticationConstants.cs +++ b/src/AspNet.Security.OAuth.Kook/KookAuthenticationConstants.cs @@ -13,12 +13,9 @@ public static class KookAuthenticationConstants { public static class Claims { - public const string IsOnline = "urn:kook:user:is_online"; - public const string IsBanned = "urn:kook:user:is_banned"; public const string OperatingSystem = "urn:kook:user:operating_system"; public const string AvatarUrl = "urn:kook:user:avatar:url"; public const string BannerUrl = "urn:kook:user:banner:url"; - public const string IsBot = "urn:kook:user:is_bot"; public const string IsMobileVerified = "urn:kook:user:is_mobile_verified"; public const string IdentifyNumber = "urn:kook:user:identify_num"; } diff --git a/src/AspNet.Security.OAuth.Kook/KookAuthenticationHandler.cs b/src/AspNet.Security.OAuth.Kook/KookAuthenticationHandler.cs index 6b53d7eb9..5ced80b7a 100644 --- a/src/AspNet.Security.OAuth.Kook/KookAuthenticationHandler.cs +++ b/src/AspNet.Security.OAuth.Kook/KookAuthenticationHandler.cs @@ -53,8 +53,6 @@ protected override async Task CreateTicketAsync( var principal = new ClaimsPrincipal(identity); var user = payload.RootElement.GetProperty("data"); - identity.AddClaim(new Claim(KookAuthenticationConstants.Claims.IsBanned, (user.GetProperty("status").GetInt32() == 10).ToString())); - var context = new OAuthCreatingTicketContext(principal, properties, Context, Scheme, Options, Backchannel, tokens, user); context.RunClaimActions(); diff --git a/src/AspNet.Security.OAuth.Kook/KookAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Kook/KookAuthenticationOptions.cs index 3432bba4c..92d892d45 100644 --- a/src/AspNet.Security.OAuth.Kook/KookAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Kook/KookAuthenticationOptions.cs @@ -25,11 +25,9 @@ public KookAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.Name, "username"); ClaimActions.MapJsonKey(ClaimTypes.MobilePhone, "mobile"); ClaimActions.MapJsonKey(KookAuthenticationConstants.Claims.IdentifyNumber, "identify_num"); - ClaimActions.MapJsonKey(KookAuthenticationConstants.Claims.IsOnline, "online"); ClaimActions.MapJsonKey(KookAuthenticationConstants.Claims.OperatingSystem, "os"); ClaimActions.MapJsonKey(KookAuthenticationConstants.Claims.AvatarUrl, "avatar"); ClaimActions.MapJsonKey(KookAuthenticationConstants.Claims.BannerUrl, "banner"); - ClaimActions.MapJsonKey(KookAuthenticationConstants.Claims.IsBot, "bot"); ClaimActions.MapJsonKey(KookAuthenticationConstants.Claims.IsMobileVerified, "mobile_verified"); Scope.Add("get_user_info"); diff --git a/test/AspNet.Security.OAuth.Providers.Tests/Kook/KookTests.cs b/test/AspNet.Security.OAuth.Providers.Tests/Kook/KookTests.cs index 9c5efc48b..0bcaf219b 100644 --- a/test/AspNet.Security.OAuth.Providers.Tests/Kook/KookTests.cs +++ b/test/AspNet.Security.OAuth.Providers.Tests/Kook/KookTests.cs @@ -27,12 +27,9 @@ protected internal override void RegisterAuthentication(AuthenticationBuilder bu [InlineData(ClaimTypes.Name, "test")] [InlineData(ClaimTypes.MobilePhone, "110****2333")] [InlineData(Claims.IdentifyNumber, "1670")] - [InlineData(Claims.IsOnline, "False")] - [InlineData(Claims.IsBanned, "False")] [InlineData(Claims.OperatingSystem, "iOS")] [InlineData(Claims.AvatarUrl, "https://xxx.com/assets/avatar.png/icon")] [InlineData(Claims.BannerUrl, "https://xxx.com/assets/banner.png/icon")] - [InlineData(Claims.IsBot, "True")] [InlineData(Claims.IsMobileVerified, "True")] public async Task Can_Sign_In_Using_Kook(string claimType, string claimValue) {