public Task AuthenticateAsync(AuthenticateContext context)
        {
            if (User == null)
            {
                context.NotAuthenticated();
            }
            else if (Scheme == null || Scheme == context.AuthenticationScheme)
            {
                context.Authenticated(User, new Dictionary<string, string>(), new Dictionary<string, object>());
            }

            return Task.FromResult(0);
        }
        public Task AuthenticateAsync(AuthenticateContext context)
        {
            if (ShouldHandleScheme(context.AuthenticationScheme))
            {
                if (User != null)
                {
                    context.Authenticated(User, properties: null,
                        description: Options.AuthenticationDescriptions.Where(descrip =>
                            string.Equals(User.Identity.AuthenticationType, descrip.AuthenticationScheme, StringComparison.Ordinal)).FirstOrDefault()?.Items);
                }
                else
                {
                    context.NotAuthenticated();
                }
            }

            if (PriorHandler != null)
            {
                return PriorHandler.AuthenticateAsync(context);
            }
            return Task.FromResult(0);
        }
 public Task AuthenticateAsync(AuthenticateContext context)
 {
     context.NotAuthenticated();
     return Task.FromResult(0);
 }
 public void Authenticate(AuthenticateContext context)
 {
     context.NotAuthenticated();
 }
Ejemplo n.º 5
0
        public virtual async Task AuthenticateAsync(AuthenticateContext context)
        {
            if (ShouldHandleScheme(context.AuthenticationScheme))
            {
                var ticket = await AuthenticateAsync();
                if (ticket?.Principal != null)
                {
                    AuthenticateCalled = true;
                    context.Authenticated(ticket.Principal, ticket.Properties.Items, BaseOptions.Description.Items);
                }
                else
                {
                    context.NotAuthenticated();
                }
            }

            if (PriorHandler != null)
            {
                await PriorHandler.AuthenticateAsync(context);
            }
        }
Ejemplo n.º 6
0
        public async Task AuthenticateAsync(AuthenticateContext context)
        {
            if (ShouldHandleScheme(context.AuthenticationScheme))
            {
                // Calling Authenticate more than once should always return the original value. 
                var ticket = await HandleAuthenticateOnceAsync();
                if (ticket?.Principal != null)
                {
                    context.Authenticated(ticket.Principal, ticket.Properties.Items, BaseOptions.Description.Items);
                }
                else
                {
                    context.NotAuthenticated();
                }
            }

            if (PriorHandler != null)
            {
                await PriorHandler.AuthenticateAsync(context);
            }
        }