Browse Source
Merge pull request #12287 from abpframework/liangshiwei/externaluser
Add IsEnabledAsync to IExternalLoginProvider
pull/12289/head
maliming
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
13 additions and
0 deletions
-
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/ExternalLoginProviderBase.cs
-
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IExternalLoginProvider.cs
-
modules/identity/test/Volo.Abp.Identity.AspNetCore.Tests/Volo/Abp/Identity/AspNetCore/FakeExternalLoginProvider.cs
|
|
|
@ -32,6 +32,8 @@ public abstract class ExternalLoginProviderBase : IExternalLoginProvider |
|
|
|
} |
|
|
|
|
|
|
|
public abstract Task<bool> TryAuthenticateAsync(string userName, string plainPassword); |
|
|
|
|
|
|
|
public abstract Task<bool> IsEnabledAsync(); |
|
|
|
|
|
|
|
public virtual async Task<IdentityUser> CreateUserAsync(string userName, string providerName) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -28,4 +28,10 @@ public interface IExternalLoginProvider |
|
|
|
/// <param name="providerName">The name of this provider</param>
|
|
|
|
/// <param name="user">The user that can be updated</param>
|
|
|
|
Task UpdateUserAsync(IdentityUser user, string providerName); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return a value indicating whether this source is enabled.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
Task<bool> IsEnabledAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -35,6 +35,11 @@ public class FakeExternalLoginProvider : ExternalLoginProviderBase, ITransientDe |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public override Task<bool> IsEnabledAsync() |
|
|
|
{ |
|
|
|
return Task.FromResult(true); |
|
|
|
} |
|
|
|
|
|
|
|
protected override Task<ExternalLoginUserInfo> GetUserInfoAsync(string userName) |
|
|
|
{ |
|
|
|
if (userName != "ext_user") |
|
|
|
|