Beispiel #1
0
        public static async Task ExecuteOnRegisteredUserEventsAsync(this IAuthEvents authEvents, IAuthSession session, IServiceBase service)
        {
            if (authEvents == null)
            {
                throw new ArgumentNullException(nameof(authEvents));
            }
            if (session == null)
            {
                throw new ArgumentNullException(nameof(session));
            }
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            var httpReq = service.Request;

            session.OnRegistered(httpReq, session, service);
            if (session is IAuthSessionExtended sessionExt)
            {
                await sessionExt.OnRegisteredAsync(httpReq, session, service).ConfigAwait();
            }
            authEvents?.OnRegistered(httpReq, session, service);
            if (authEvents is IAuthEventsAsync asyncEvents)
            {
                await asyncEvents.OnRegisteredAsync(httpReq, session, service).ConfigAwait();
            }
        }
Beispiel #2
0
 public UserService(IAuthRepository authRepo, IAuthEvents authEvents)
 {
     AuthRepo   = authRepo;
     AuthEvents = authEvents;
 }