Activities of "mc86"

你好 现在有问题,可能是什么导致的呢? 我使用https://authserver:28443/Passwordless/Login?userId=0630&token=123 跳转到authserver的Passwordless

可以正常跳转,跳转后进入页面开始验证.但是最终会跳转到Logout

` [HttpGet("Login")] public virtual async Task

 await UserManager.UpdateSecurityStampAsync(user);

  await SignInManager.SignInAsync(user, isPersistent: false);

 var blazorserver= "http://blazorserver:28444";
 return Redirect(blazorserver);

}`

BLAZOR -log

2025-09-18 10:41:00.187 +08:00 [INF] Request starting HTTP/1.1 GET http://master.aysdlrmyy.com:28444/ - null null 2025-09-18 10:41:00.187 +08:00 [INF] Executing endpoint '/ (/)' 2025-09-18 10:41:00.192 +08:00 [WRN] Could not find IdentityClientConfiguration for AbpMvcClient. Either define a configuration for AbpMvcClient or set a default configuration. 2025-09-18 10:41:00.192 +08:00 [INF] Start processing HTTP request GET https://master.aysdlrmyy.com:28445/api/abp/application-configuration?* 2025-09-18 10:41:00.192 +08:00 [INF] Sending HTTP request GET https://master.aysdlrmyy.com:28445/api/abp/application-configuration?* 2025-09-18 10:41:00.250 +08:00 [INF] Received HTTP response headers after 57.9971ms - 200 2025-09-18 10:41:00.250 +08:00 [INF] End processing HTTP request after 58.2247ms - 200 2025-09-18 10:41:00.251 +08:00 [WRN] Could not find IdentityClientConfiguration for AbpMvcClient. Either define a configuration for AbpMvcClient or set a default configuration. 2025-09-18 10:41:00.251 +08:00 [INF] Start processing HTTP request GET https://master.aysdlrmyy.com:28445/api/abp/application-localization?* 2025-09-18 10:41:00.251 +08:00 [INF] Sending HTTP request GET https://master.aysdlrmyy.com:28445/api/abp/application-localization?* 2025-09-18 10:41:00.392 +08:00 [INF] Received HTTP response headers after 141.242ms - 200 2025-09-18 10:41:00.392 +08:00 [INF] End processing HTTP request after 141.4583ms - 200 2025-09-18 10:41:00.394 +08:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: SettingManagement.Emailing

AUTH-SERVER 2025-09-18 10:41:00.070 +08:00 [INF] Request starting HTTP/2 GET https://master.aysdlrmyy.com:28443/Passwordless/Login?userId=admin&token=123 - null null 2025-09-18 10:41:00.073 +08:00 [INF] Executing endpoint 'Master9.Custom.PasswordlessController.Login (Master9.AuthServer)' 2025-09-18 10:41:00.073 +08:00 [INF] Route matched with {action = "Login", controller = "Passwordless", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.IActionResult] Login(System.String, System.String) on controller Master9.Custom.PasswordlessController (Master9.AuthServer). 2025-09-18 10:41:00.167 +08:00 [INF] AuthenticationScheme: Identity.Application signed in. 2025-09-18 10:41:00.169 +08:00 [INF] Executing RedirectResult, redirecting to http://master.aysdlrmyy.com:28444. 2025-09-18 10:41:00.169 +08:00 [INF] Executed action Master9.Custom.PasswordlessController.Login (Master9.AuthServer) in 96.0496ms 2025-09-18 10:41:00.169 +08:00 [INF] Executed endpoint 'Master9.Custom.PasswordlessController.Login (Master9.AuthServer)' 2025-09-18 10:41:00.171 +08:00 [INF] Request finished HTTP/2 GET https://master.aysdlrmyy.com:28443/Passwordless/Login?userId=admin&token=123 - 302 null null 101.0982ms 2025-09-18 10:41:05.135 +08:00 [INF] Request starting HTTP/2 GET https://master.aysdlrmyy.com:28443/connect/logout?post_logout_redirect_uri=http%3A%2F%2Fmaster.aysdlrmyy.com%3A28444%2Fsignout-callback-oidc&state=CfDJ8D2ygYFMKaZGvAEpZ3bmx8lReZ3O7KYHF1W13nbjz63FeaXjQWKJ-wBoj9J1H7UXTDAAAuB2CIFIwOXP2pJETFdea2hXUO2mpi9Jx2dBIVoS-6SwSZcCJ00gYo3K6eLy1wXoVpL82stixCDdakYY7pA&x-client-SKU=ID_NET9_0&x-client-ver=8.1.0.0 - null null 2025-09-18 10:41:05.136 +08:00 [INF] The request URI matched a server endpoint: "Logout". 2025-09-18 10:41:05.136 +08:00 [INF] The logout request was successfully extracted: { "post_logout_redirect_uri": "http://master.aysdlrmyy.com:28444/signout-callback-oidc", "state": "CfDJ8D2ygYFMKaZGvAEpZ3bmx8lReZ3O7KYHF1W13nbjz63FeaXjQWKJ-wBoj9J1H7UXTDAAAuB2CIFIwOXP2pJETFdea2hXUO2mpi9Jx2dBIVoS-6SwSZcCJ00gYo3K6eLy1wXoVpL82stixCDdakYY7pA", "x-client-SKU": "ID_NET9_0", "x-client-ver": "8.1.0.0" }. 2025-09-18 10:41:05.139 +08:00 [INF] The logout request was rejected because the specified post_logout_redirect_uri was invalid: http://master.aysdlrmyy.com:28444/signout-callback-oidc. 2025-09-18 10:41:05.139 +08:00 [INF] Request finished HTTP/2 GET https://master.aysdlrmyy.com:28443/connect/logout?post_logout_redirect_uri=http%3A%2F%2Fmaster.aysdlrmyy.com%3A28444%2Fsignout-callback-oidc&state=CfDJ8D2ygYFMKaZGvAEpZ3bmx8lReZ3O7KYHF1W13nbjz63FeaXjQWKJ-wBoj9J1H7UXTDAAAuB2CIFIwOXP2pJETFdea2hXUO2mpi9Jx2dBIVoS-6SwSZcCJ00gYo3K6eLy1wXoVpL82stixCDdakYY7pA&x-client-SKU=ID_NET9_0&x-client-ver=8.1.0.0 - 302 null null 4.0188ms 2025-09-18 10:41:05.141 +08:00 [INF] Request starting HTTP/2 GET https://master.aysdlrmyy.com:28443/Error?httpStatusCode=400 - null null 2025-09-18 10:41:05.213 +08:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2025-09-18 10:41:05.213 +08:00 [INF] Route matched with {action = "Index", controller = "Error", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.IActionResult] Index(Int32) on controller Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared). 2025-09-18 10:41:05.221 +08:00 [INF] Executing ViewResult, running view ~/Views/Error/Default.cshtml. 2025-09-18 10:41:05.239 +08:00 [INF] Executed ViewResult - view ~/Views/Error/Default.cshtml executed in 17.2282ms. 2025-09-18 10:41:05.239 +08:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared) in 25.4387ms 2025-09-18 10:41:05.239 +08:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)'

好的 我试一下,谢谢~

1.请求autheserver的passwordlesscontroller. 完成signin 2.打开blazor server 或者wassm的有认证要求的页面 3.自动跳转到autheserver,无需输入密码 4.autheserver跳转回请求页面 是这也吗

能不能直接打开blazor sever的页面A,在A中请求passwordlesscontroller. 然后触发认证?

通过链接用一次性密码在authserver中完成登陆.

Chould you give me more infomation about how to do it ? like step by step. what i need to do in both blazor and AuthServer? thanks a lot.

I know they use Cookie or OpenID Connect , But I'd like to Know how Blazor Server and WASM implement Passwordless Login with auth server.

hi maliming how Blazor Server or WASM implement passwordless login. like use a link redrickt to Blazor Server and keep a user login. I had a EmployeeNumberGrantHandler too. ` public class EmployeeNumberGrantHandler : IOpenIddictServerHandler<OpenIddictServerEvents.HandleTokenRequestContext> { public static OpenIddictServerHandlerDescriptor Descriptor { get; } = OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.HandleTokenRequestContext>() .UseScopedHandler

  private readonly IdentityUserManager _userManager;

  public EmployeeNumberGrantHandler(IdentityUserManager userManager)
  {
      _userManager = userManager;
  }

  public async ValueTask HandleAsync(OpenIddictServerEvents.HandleTokenRequestContext context)
  {
      try
      {
          if (!string.Equals(context.Request.GrantType, "employee_number", StringComparison.Ordinal))
              return ;

          var empNo = context.Request["employee_number"]?.ToString();
          var ts = context.Request["timestamp"]?.ToString();
          var signature = context.Request["signature"]?.ToString();

          if (string.IsNullOrEmpty(empNo) || string.IsNullOrEmpty(ts) || string.IsNullOrEmpty(signature))
          {
              context.Reject(OpenIddictConstants.Errors.InvalidRequest, "Missing parameters.");
              return  ;
          }

          // 1. 检查时间戳有效性
          if (!long.TryParse(ts, out var ticks) ||
              DateTime.UtcNow - new DateTime(ticks, DateTimeKind.Utc) > TimeSpan.FromMinutes(5))
          {
              context.Reject(OpenIddictConstants.Errors.InvalidGrant, "Expired timestamp.");
              return  ;
          }

          // 2. 验证签名
          var raw = $"{empNo}:{ts}";
          if (!VerifySignature(raw, signature, "SuperSecretSharedKey123!"))
          {
              context.Reject(OpenIddictConstants.Errors.InvalidGrant, "Invalid signature.");
              return  ;
          }

          // 3. 查找用户
          var user = await _userManager.FindByNameAsync(empNo);
          if (user == null)
          {
              context.Reject(OpenIddictConstants.Errors.InvalidGrant, "User not found.");
              return;
          }

          // 4. 创建 ClaimsIdentity
          var identity = new ClaimsIdentity(
              TokenValidationParameters.DefaultAuthenticationType,
              OpenIddictConstants.Claims.Name,
              OpenIddictConstants.Claims.Role);

          // subject(必须)
          var subject = new Claim(OpenIddictConstants.Claims.Subject, user.Id.ToString());
          subject.SetDestinations(OpenIddictConstants.Destinations.AccessToken,
                                  OpenIddictConstants.Destinations.IdentityToken);
          identity.AddClaim(subject);

          // 用户名
          var name = new Claim(OpenIddictConstants.Claims.Name, user.UserName ?? empNo);
          name.SetDestinations(OpenIddictConstants.Destinations.AccessToken,
                               OpenIddictConstants.Destinations.IdentityToken);
          identity.AddClaim(name);

          // 工号
          var empNoClaim = new Claim("employee_number", empNo);
          empNoClaim.SetDestinations(OpenIddictConstants.Destinations.AccessToken,
                                     OpenIddictConstants.Destinations.IdentityToken);
          identity.AddClaim(empNoClaim);

          // 5. 创建 principal
          var principal = new ClaimsPrincipal(identity);

          // 给 token 添加 scopes(至少 openid/profile,客户端必须要请求)
          principal.SetScopes(new[]
          {
              OpenIddictConstants.Scopes.OpenId,
              OpenIddictConstants.Scopes.Profile,
              OpenIddictConstants.Scopes.Email,
              OpenIddictConstants.Scopes.Roles
          }.Intersect(context.Request.GetScopes()));

          // 可以给 access_token 附加 API 资源
          principal.SetResources("resource_server");

          context.Principal = principal;
          context.SignIn(principal);
          context.HandleRequest(); 
      }
      catch (Exception ex)
      {
          context.Reject(OpenIddictConstants.Errors.InvalidGrant, ex.Message);
          return  ;
      }
     
       
  }

  private static bool VerifySignature(string raw, string signature, string secretKey)
  {
      using var hmac = new System.Security.Cryptography.HMACSHA256(System.Text.Encoding.UTF8.GetBytes(secretKey));
      var hash = hmac.ComputeHash(System.Text.Encoding.UTF8.GetBytes(raw));
      var expected = Convert.ToBase64String(hash);
      return expected == signature;
  }

}`

HI: I had my customgrant named EmployeeNumberGrant `public class EmployeeNumberGrant : ITokenExtensionGrant { public const string ExtensionGrantName = "employee_number";

public string Name => ExtensionGrantName;

private  IdentityUserManager _userManager;
private  IUserClaimsPrincipalFactory<IdentityUser> _claimsFactory;
private  AbpOpenIddictClaimsPrincipalManager _claimsPrincipalManager;
private AbpSignInManager _signInManager;
public EmployeeNumberGrant(
    IdentityUserManager userManager,
    IUserClaimsPrincipalFactory<IdentityUser> claimsFactory,
    AbpOpenIddictClaimsPrincipalManager claimsPrincipalManager)
{
    _userManager = userManager;
    _claimsFactory = claimsFactory;
    _claimsPrincipalManager = claimsPrincipalManager;
    
}

public EmployeeNumberGrant()
{
    

}

public async Task<IActionResult> HandleAsync(ExtensionGrantContext context)
{
    _userManager = context.HttpContext.RequestServices.GetRequiredService<IdentityUserManager>();
    _claimsFactory = context.HttpContext.RequestServices.GetRequiredService<IUserClaimsPrincipalFactory<IdentityUser>>();
    _claimsPrincipalManager = context.HttpContext.RequestServices.GetRequiredService<AbpOpenIddictClaimsPrincipalManager>();
    _signInManager= context.HttpContext.RequestServices.GetRequiredService<AbpSignInManager>();
    var empNo = context.Request.GetParameter("employee_number")?.ToString();
    var ts = context.Request.GetParameter("timestamp")?.ToString();
    var signature = context.Request.GetParameter("signature")?.ToString();

    if (string.IsNullOrEmpty(empNo) || string.IsNullOrEmpty(ts) || string.IsNullOrEmpty(signature))
    {
        return new ForbidResult(new[] { OpenIddictServerAspNetCoreDefaults.AuthenticationScheme },
            new AuthenticationProperties(new Dictionary<string, string>
            {
                [OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidRequest,
                [OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "Missing parameters."
            }));
    }

    // 1. 校验时间戳
    if (!long.TryParse(ts, out var ticks) ||
        DateTime.UtcNow - new DateTime(ticks, DateTimeKind.Utc) > TimeSpan.FromMinutes(5))
    {
        return new ForbidResult(new[] { OpenIddictServerAspNetCoreDefaults.AuthenticationScheme },
            new AuthenticationProperties(new Dictionary<string, string>
            {
                [OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
                [OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "Expired timestamp."
            }));
    }

    // 2. 校验签名
    var raw = $"{empNo}:{ts}";
    if (!VerifySignature(raw, signature, "SuperSecretSharedKey123!"))
    {
        return new ForbidResult(new[] { OpenIddictServerAspNetCoreDefaults.AuthenticationScheme },
            new AuthenticationProperties(new Dictionary<string, string>
            {
                [OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
                [OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "Invalid signature."
            }));
    }

    // 3. 查找用户
    var user = await _userManager.FindByNameAsync(empNo);
    if (user == null)
    {
        return new ForbidResult(new[] { OpenIddictServerAspNetCoreDefaults.AuthenticationScheme },
            new AuthenticationProperties(new Dictionary<string, string>
            {
                [OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
                [OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "User not found."
            }));
    }

    // 4. 创建 ClaimsPrincipal
    var principal = await _claimsFactory.CreateAsync(user);

    // 附加自定义 Claim
    ((ClaimsIdentity)principal.Identity!).AddClaim("employee_number", empNo);

    // 设置 scopes
    var scopes = new[] {"profile", "roles", "email", "phone", "offline_access", "master9" }.ToImmutableArray();
    principal.SetScopes(scopes);

    // 关联资源
    var resources = new List<string>();
    await foreach (var resource in context.HttpContext.RequestServices
                       .GetRequiredService<IOpenIddictScopeManager>()
                       .ListResourcesAsync(scopes))
    {
        resources.Add(resource);
    }
    principal.SetResources(resources);
    principal.SetAudiences("Master9");
    // 交给 ABP 内置 ClaimsPrincipalManager 处理(角色、权限等)
    await _claimsPrincipalManager.HandleAsync(context.Request, principal);
    //principal.SetScopes(context.Request.GetScopes());

 
   // await _signInManager.SignInAsync(user, isPersistent: false);
    return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, principal);
}

private static bool VerifySignature(string raw, string signature, string secretKey)
{
    using var hmac = new System.Security.Cryptography.HMACSHA256(System.Text.Encoding.UTF8.GetBytes(secretKey));
    var hash = hmac.ComputeHash(System.Text.Encoding.UTF8.GetBytes(raw));
    var expected = Convert.ToBase64String(hash);
    return expected == signature;
}

}`

now I don't know how to make blazor app login with this grant.

  • ABP Framework version: v8.2.X
  • UI Type: Blazor
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular):no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

HI I created a module project when I open a entity creat window GUID property doesn't show in the properties select box.

but in the main project abp suite supports GUID type. through there also a bug with guid type in SEARCH box

  • ABP Framework version: v8.2.1
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

for example,if I want to use indentity user in one entity in my module should I reference Volo.Abp.Identity.pro in each project. or install Volo.Abp.Identity module,so when i chose "Include entities from ABP modules" then I can choses ABP entities.

Showing 41 to 50 of 137 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 21, 2026, 11:09
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.