Skip to content

Commit

Permalink
fix: Unable to find ldapOption when logging in with domain account (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wzh425 authored Dec 12, 2024
1 parent 1d3f1bc commit 0fd905c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.

namespace Masa.Auth.Web.Sso.Infrastructure.Constants;

public class LdapConsts
{
public const string LDAP_NAME = "Ldap";
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task ValidateAsync(ExtensionGrantValidationContext context)

var password = context.Request.Raw["password"] ?? string.Empty;

var ldapOption = await _thirdPartyIdpService.GetLdapOptionsAsync(BuildingBlocks.Authentication.OpenIdConnect.Models.Constans.GrantType.LDAP);
var ldapOption = await _thirdPartyIdpService.GetLdapOptionsAsync(LdapConsts.LDAP_NAME);
if (ldapOption is null)
{
throw new UserFriendlyException($"Not find ldap");
Expand Down Expand Up @@ -65,7 +65,7 @@ public async Task ValidateAsync(ExtensionGrantValidationContext context)
{
authUser = await _authClient.UserService.AddThirdPartyUserAsync(new AddThirdPartyUserModel
{
Scheme = "Ldap",
Scheme = LdapConsts.LDAP_NAME,
ThridPartyIdentity = ldapUser.ObjectGuid,
ExtendedData = ldapUser,
User = new AddUserModel
Expand Down
1 change: 1 addition & 0 deletions src/Web/Masa.Auth.Web.Sso/_Imports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
global using Masa.Auth.Web.Sso.Infrastructure;
global using Masa.Auth.Web.Sso.Infrastructure.Aliyun;
global using Masa.Auth.Web.Sso.Infrastructure.Attributes;
global using Masa.Auth.Web.Sso.Infrastructure.Constants;
global using Masa.Auth.Web.Sso.Infrastructure.Events;
global using Masa.Auth.Web.Sso.Infrastructure.Options;
global using Masa.Auth.Web.Sso.Infrastructure.Services;
Expand Down

0 comments on commit 0fd905c

Please sign in to comment.