- 
                Notifications
    You must be signed in to change notification settings 
- Fork 552
Add Douyin provider #1024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            Loongle
  wants to merge
  12
  commits into
  aspnet-contrib:dev
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
Loongle:dev
  
      
      
   
  
    
  
  
  
 
  
      
    base: dev
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Add Douyin provider #1024
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            12 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      594cfac
              
                Add Douyin provider
              
              
                Loongle ee0ebb6
              
                Remove doyin.md
              
              
                Loongle 0528c42
              
                Update Douyin csproj
              
              
                Loongle 7adfdcc
              
                Fix logic error and typo in comments of ValidateReturnCode method
              
              
                Loongle 30a95b2
              
                Remove HandleRemoteAuthenticateAsync
              
              
                Loongle 139fa75
              
                Add BuildChallengeUrl test
              
              
                Loongle 7cc7a50
              
                Update README.md: Remove Douyin link
              
              
                Loongle 1110877
              
                Remove invalid references
              
              
                Loongle aee5de2
              
                Remove extra white space
              
              
                Loongle 54c877d
              
                Resolve merge conflicts.
              
              
                Loongle a8c7d32
              
                Remove duplicate references to docusign.md file
              
              
                Loongle 631501e
              
                Merge branch 'dev' into dev
              
              
                Loongle File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            23 changes: 23 additions & 0 deletions
          
          23 
        
  src/AspNet.Security.OAuth.Douyin/AspNet.Security.OAuth.Douyin.csproj
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|  | ||
| <PropertyGroup> | ||
| <PackageValidationBaselineVersion>9.1.0</PackageValidationBaselineVersion> | ||
| <TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks> | ||
| </PropertyGroup> | ||
|  | ||
| <!-- TODO Remove once published to NuGet.org --> | ||
| <PropertyGroup> | ||
| <DisablePackageBaselineValidation>true</DisablePackageBaselineValidation> | ||
| </PropertyGroup> | ||
|  | ||
| <PropertyGroup> | ||
| <Description>ASP.NET Core security middleware enabling Douyin authentication.</Description> | ||
| <Authors>Loongle Tse</Authors> | ||
| <PackageTags>douyin;bytedance;aspnetcore;authentication;oauth;security</PackageTags> | ||
| </PropertyGroup> | ||
|  | ||
| <ItemGroup> | ||
| <FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
| <PackageReference Include="JetBrains.Annotations" PrivateAssets="All" /> | ||
| </ItemGroup> | ||
| </Project> | 
        
          
          
            20 changes: 20 additions & 0 deletions
          
          20 
        
  src/AspNet.Security.OAuth.Douyin/DouyinAuthenticationConstants.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers | ||
| * for more information concerning the license and the contributors participating to this project. | ||
| */ | ||
|  | ||
| namespace AspNet.Security.OAuth.Douyin; | ||
|  | ||
| /// <summary> | ||
| /// Contains constants specific to the <see cref="DouyinAuthenticationHandler"/>. | ||
| /// </summary> | ||
| public static class DouyinAuthenticationConstants | ||
| { | ||
| public static class Claims | ||
| { | ||
| public const string Avatar = "urn:douyin:avatar"; | ||
|  | ||
| public const string Nickname = "urn:douyin:nickname"; | ||
| } | ||
| } | 
        
          
          
            48 changes: 48 additions & 0 deletions
          
          48 
        
  src/AspNet.Security.OAuth.Douyin/DouyinAuthenticationDefaults.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers | ||
| * for more information concerning the license and the contributors participating to this project. | ||
| */ | ||
|  | ||
| namespace AspNet.Security.OAuth.Douyin; | ||
|  | ||
| /// <summary> | ||
| /// Default values for Douyin authentication. | ||
| /// </summary> | ||
| public static class DouyinAuthenticationDefaults | ||
| { | ||
| /// <summary> | ||
| /// Default value for <see cref="AuthenticationScheme.Name"/>. | ||
| /// </summary> | ||
| public const string AuthenticationScheme = "Douyin"; | ||
|  | ||
| /// <summary> | ||
| /// Default value for <see cref="AuthenticationScheme.DisplayName"/>. | ||
| /// </summary> | ||
| public static readonly string DisplayName = "Douyin"; | ||
|  | ||
| /// <summary> | ||
| /// Default value for <see cref="AuthenticationSchemeOptions.ClaimsIssuer"/>. | ||
| /// </summary> | ||
| public static readonly string Issuer = "Douyin"; | ||
|  | ||
| /// <summary> | ||
| /// Default value for <see cref="RemoteAuthenticationOptions.CallbackPath"/>. | ||
| /// </summary> | ||
| public static readonly string CallbackPath = "/signin-douyin"; | ||
|  | ||
| /// <summary> | ||
| /// Default value for <see cref="OAuthOptions.AuthorizationEndpoint"/>. | ||
| /// </summary> | ||
| public static readonly string AuthorizationEndpoint = "https://open.douyin.com/platform/oauth/connect/"; | ||
|  | ||
| /// <summary> | ||
| /// Default value for <see cref="OAuthOptions.TokenEndpoint"/>. | ||
| /// </summary> | ||
| public static readonly string TokenEndpoint = "https://open.douyin.com/oauth/access_token/"; | ||
|  | ||
| /// <summary> | ||
| /// Default value for <see cref="OAuthOptions.UserInformationEndpoint"/>. | ||
| /// </summary> | ||
| public static readonly string UserInformationEndpoint = "https://open.douyin.com/oauth/userinfo/"; | ||
| } | 
        
          
          
            74 changes: 74 additions & 0 deletions
          
          74 
        
  src/AspNet.Security.OAuth.Douyin/DouyinAuthenticationExtensions.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers | ||
| * for more information concerning the license and the contributors participating to this project. | ||
| */ | ||
|  | ||
| using AspNet.Security.OAuth.Douyin; | ||
|  | ||
| namespace Microsoft.Extensions.DependencyInjection; | ||
|  | ||
| /// <summary> | ||
| /// Extension methods to add Douyin authentication capabilities to an HTTP application pipeline. | ||
| /// </summary> | ||
| public static class DouyinAuthenticationExtensions | ||
| { | ||
| /// <summary> | ||
| /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified | ||
| /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. | ||
| /// </summary> | ||
| /// <param name="builder">The authentication builder.</param> | ||
| /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
| public static AuthenticationBuilder AddDouyin([NotNull] this AuthenticationBuilder builder) | ||
| { | ||
| return builder.AddDouyin(DouyinAuthenticationDefaults.AuthenticationScheme, options => { }); | ||
| } | ||
|  | ||
| /// <summary> | ||
| /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified | ||
| /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. | ||
| /// </summary> | ||
| /// <param name="builder">The authentication builder.</param> | ||
| /// <param name="configuration">The delegate used to configure the OpenID 2.0 options.</param> | ||
| /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
| public static AuthenticationBuilder AddDouyin( | ||
| [NotNull] this AuthenticationBuilder builder, | ||
| [NotNull] Action<DouyinAuthenticationOptions> configuration) | ||
| { | ||
| return builder.AddDouyin(DouyinAuthenticationDefaults.AuthenticationScheme, configuration); | ||
| } | ||
|  | ||
| /// <summary> | ||
| /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified | ||
| /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. | ||
| /// </summary> | ||
| /// <param name="builder">The authentication builder.</param> | ||
| /// <param name="scheme">The authentication scheme associated with this instance.</param> | ||
| /// <param name="configuration">The delegate used to configure the Douyin options.</param> | ||
| /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
| public static AuthenticationBuilder AddDouyin( | ||
| [NotNull] this AuthenticationBuilder builder, | ||
| [NotNull] string scheme, | ||
| [NotNull] Action<DouyinAuthenticationOptions> configuration) | ||
| { | ||
| return builder.AddDouyin(scheme, DouyinAuthenticationDefaults.DisplayName, configuration); | ||
| } | ||
|  | ||
| /// <summary> | ||
| /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified | ||
| /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. | ||
| /// </summary> | ||
| /// <param name="builder">The authentication builder.</param> | ||
| /// <param name="scheme">The authentication scheme associated with this instance.</param> | ||
| /// <param name="caption">The optional display name associated with this instance.</param> | ||
| /// <param name="configuration">The delegate used to configure the Douyin options.</param> | ||
| /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
| public static AuthenticationBuilder AddDouyin( | ||
| [NotNull] this AuthenticationBuilder builder, | ||
| [NotNull] string scheme, | ||
| [CanBeNull] string caption, | ||
| [NotNull] Action<DouyinAuthenticationOptions> configuration) | ||
| { | ||
| return builder.AddOAuth<DouyinAuthenticationOptions, DouyinAuthenticationHandler>(scheme, caption, configuration); | ||
| } | ||
| } | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.