Activities of "viswajwalith"

[DependsOn(typeof(AbpIdentityAspNetCoreModule))]

Thanks for the quick turnaround. I already included cs file

but SignInAsync is not found

Am I missing anything?

Can you try to depend of AbpIdentityAspNetCoreModule?

I tried but not sure is it what you mean to say. because SignInAsync is not part of that

SignInManager

It seems the problem is with initiation of SignInManager

We have created new controller called passwordless2

Please share code of passwordless2

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;
using Volo.Abp.Identity.AspNetCore;

namespace Passwordless2Authentication.Web.Controllers
{
    public class Passwordless2Controller : AbpController
    {
        protected IdentityUserManager UserManager { get; }

        protected AbpSignInManager SignInManager { get; }

        public Passwordless2Controller(IdentityUserManager userManager, AbpSignInManager signInManager)
        {
            UserManager = userManager;
            SignInManager = signInManager;
        }

        public virtual async Task<IActionResult> Login(string token, string userId)
        {
            var user = await UserManager.FindByIdAsync(userId);

            var isValid = await UserManager.VerifyUserTokenAsync(user, "PasswordlessLoginProvider", "passwordless-auth", token);
            if (!isValid)
            {
                throw new UnauthorizedAccessException("The token " + token + " is not valid for the user " + userId);
            }

            await UserManager.UpdateSecurityStampAsync(user);

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

            return Redirect("/");
        }
    }
}
``

We have created new controller called passwordless2 and tried ur code, but getting the below error. are we missing anything?

Error Log: 2021-09-16 13:19:50.105 +00:00 [INF] Request starting HTTP/2 GET https://localhost:44321/Passwordless2/Login?token=727076&userId=bc89cb04-d25d-651e-9417-39fcb9258fd3 - - 2021-09-16 13:19:50.121 +00:00 [INF] Executing endpoint 'Passwordless2Authentication.Web.Controllers.Passwordless2Controller.Login (Exceego.EHSWatch.AppV3.Web)' 2021-09-16 13:19:50.121 +00:00 [INF] Route matched with {action = "Login", controller = "Passwordless2", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.IActionResult] Login(System.String, System.String) on controller Passwordless2Authentication.Web.Controllers.Passwordless2Controller (Exceego.EHSWatch.AppV3.Web). 2021-09-16 13:19:50.125 +00:00 [INF] Executed action Passwordless2Authentication.Web.Controllers.Passwordless2Controller.Login (Exceego.EHSWatch.AppV3.Web) in 4.0034ms 2021-09-16 13:19:50.126 +00:00 [INF] Executed endpoint 'Passwordless2Authentication.Web.Controllers.Passwordless2Controller.Login (Exceego.EHSWatch.AppV3.Web)' 2021-09-16 13:19:50.130 +00:00 [ERR] An unhandled exception has occurred while executing the request. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Passwordless2Authentication.Web.Controllers.Passwordless2Controller. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Volo.Abp.Autofac.AbpAutofacConstructorFinder' on type 'Passwordless2Authentication.Web.Controllers.Passwordless2Controller' can be invoked with the available services and parameters: Cannot resolve parameter 'Volo.Abp.Identity.AspNetCore.AbpSignInManager signInManager' of constructor 'Void .ctor(Volo.Abp.Identity.IdentityUserManager, Volo.Abp.Identity.AspNetCore.AbpSignInManager)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.GetAllBindings(ConstructorBinder[] availableConstructors, IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action1 next) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Builder.RegistrationBuilder3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action1 next) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context) at Elsa.Activities.Http.Middleware.RequestHandlerMiddleware1.InvokeAsync(HttpContext httpContext, THandler handler) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Prometheus.HttpMetrics.HttpRequestDurationMiddleware.Invoke(HttpContext context) at Prometheus.HttpMetrics.HttpRequestCountMiddleware.Invoke(HttpContext context) at Prometheus.HttpMetrics.HttpInProgressMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) 2021-09-16 13:19:50.139 +00:00 [INF] Request finished HTTP/2 GET https://localhost:44321/Passwordless2/Login?token=727076&userId=bc89cb04-d25d-651e-9417-39fcb9258fd3 - - - 500 - text/html;+charset=utf-8 33.7823ms

Did you define claims for the user that try to login passwordless, like here?
These claims are required for user and role specific permissions.

Yes we did but still will cross verify and get back to you

This is what we had in out code

after login, I kept the display of claims in home page

You can see role is coming as admin.

Our actual menu will look like something below

Did you define claims for the user that try to login passwordless, like here? These claims are required for user and role specific permissions.

Yes we did but still will cross verify and get back to you

Hi @viswajwalith, there is a community article about passwordless authentication, you can read from here. Can you check it and ensure there are not any steps that you missed?

Hi we already followed that but that is for Application Template, when we implemented the same in Micro service template facing the above issue mentioned

  • ABP Framework version: v4.2.X
  • UI type: MVC
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hello, We are trying to implement passwordless sign-in refer to this link (https://github.com/abpframework/abp-samples/tree/master/PasswordlessAuthentication). On Successful sign and redirect to the home page page, we are unable to see our application menus it seems some permission issues. Can you help us lettig us know if we missed any? Do we suppose to do any kind of callback after sign-in Do we suppose to add any extra claim to this login portion of code (https://github.com/abpframework/abp-samples/blob/master/PasswordlessAuthentication/src/PasswordlessAuthentication.Web/Controllers/PasswordlessController.cs)

I tried thsi as well, but no luck. Please find my updated docker file and let us know anything else also need to be done

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
ENV DOTNET_USE_POLLING_FILE_WATCHER 1
WORKDIR /src
#COPY ["nuget.config", "."]
RUN dotnet tool install -g dotnet-serve
ENV PATH="${PATH}:/root/.dotnet/tools"
RUN dotnet tool install --global Volo.Abp.Cli
RUN abp login "USERNAME" -p "PASSWORD"
COPY ["gateways/internal/src/Exceego.EHSWatch.AppV3.InternalGateway/Exceego.EHSWatch.AppV3.InternalGateway.csproj", "gateways/internal/src/Exceego.EHSWatch.AppV3.InternalGateway/"]
COPY ["shared/Exceego.EHSWatch.AppV3.Shared.Hosting.Gateways/Exceego.EHSWatch.AppV3.Shared.Hosting.Gateways.csproj", "shared/Exceego.EHSWatch.AppV3.Shared.Hosting.Gateways/"]
COPY ["shared/Exceego.EHSWatch.AppV3.Shared.Hosting.AspNetCore/Exceego.EHSWatch.AppV3.Shared.Hosting.AspNetCore.csproj", "shared/Exceego.EHSWatch.AppV3.Shared.Hosting.AspNetCore/"]
COPY ["shared/Exceego.EHSWatch.AppV3.Shared.Hosting/Exceego.EHSWatch.AppV3.Shared.Hosting.csproj", "shared/Exceego.EHSWatch.AppV3.Shared.Hosting/"]
RUN dotnet restore "gateways/internal/src/Exceego.EHSWatch.AppV3.InternalGateway/Exceego.EHSWatch.AppV3.InternalGateway.csproj"
COPY . .
WORKDIR "/src/gateways/internal/src/Exceego.EHSWatch.AppV3.InternalGateway"
RUN dotnet build "Exceego.EHSWatch.AppV3.InternalGateway.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Exceego.EHSWatch.AppV3.InternalGateway.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Exceego.EHSWatch.AppV3.InternalGateway.dll"]
Showing 121 to 130 of 228 entries
Made with ❤️ on ABP v9.2.0-preview. Updated on January 14, 2025, 14:54