コード例 #1
0
 public void Authenticate(IAuthenticateContext context)
 {
     if (PriorHandler != null)
     {
         PriorHandler.Authenticate(context);
         ApplyTransform(context);
     }
 }
コード例 #2
0
        public async Task AuthenticateAsync(IAuthenticateContext context)
        {
            if (PriorHandler != null)
            {
                await PriorHandler.AuthenticateAsync(context);

                ApplyTransform(context);
            }
        }
コード例 #3
0
 private void ApplyTransform(IAuthenticateContext context)
 {
     if (_transform != null)
     {
         // REVIEW: this cast seems really bad (missing interface way to get the result back out?)
         var authContext = context as AuthenticateContext;
         if (authContext?.Result?.Principal != null)
         {
             context.Authenticated(
                 _transform.Invoke(authContext.Result.Principal),
                 authContext.Result.Properties.Dictionary,
                 authContext.Result.Description.Dictionary);
         }
     }
 }
コード例 #4
0
        public virtual void Authenticate(IAuthenticateContext context)
        {
            if (context.AuthenticationTypes.Contains(BaseOptions.AuthenticationType, StringComparer.Ordinal))
            {
                AuthenticationTicket ticket = Authenticate();
                if (ticket != null && ticket.Identity != null)
                {
                    context.Authenticated(ticket.Identity, ticket.Properties.Dictionary, BaseOptions.Description.Dictionary);
                }
                else
                {
                    context.NotAuthenticated(BaseOptions.AuthenticationType, properties: null, description: BaseOptions.Description.Dictionary);
                }
            }

            if (PriorHandler != null)
            {
                PriorHandler.Authenticate(context);
            }
        }
コード例 #5
0
        public virtual void Authenticate(IAuthenticateContext context)
        {
            if (ShouldHandleScheme(context.AuthenticationScheme))
            {
                var ticket = Authenticate();
                if (ticket?.Principal != null)
                {
                    AuthenticateCalled = true;
                    context.Authenticated(ticket.Principal, ticket.Properties.Dictionary, BaseOptions.Description.Dictionary);
                }
                else
                {
                    context.NotAuthenticated();
                }
            }

            if (PriorHandler != null)
            {
                PriorHandler.Authenticate(context);
            }
        }
コード例 #6
0
        public virtual async Task AuthenticateAsync(IAuthenticateContext context)
        {
            if (ShouldHandleScheme(context.AuthenticationScheme))
            {
                var ticket = await AuthenticateAsync();
                if (ticket?.Principal != null)
                {
                    AuthenticateCalled = true;
                    context.Authenticated(ticket.Principal, ticket.Properties.Dictionary, BaseOptions.Description.Dictionary);
                }
                else
                {
                    context.NotAuthenticated();
                }
            }

            if (PriorHandler != null)
            {
                await PriorHandler.AuthenticateAsync(context);
            }
        }
コード例 #7
0
 public Task AuthenticateAsync(IAuthenticateContext context)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 public void Authenticate(IAuthenticateContext context)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
        public virtual async Task AuthenticateAsync(IAuthenticateContext context)
        {
            if (context.AuthenticationTypes.Contains(BaseOptions.AuthenticationType, StringComparer.Ordinal))
            {
                AuthenticationTicket ticket = await AuthenticateAsync();
                if (ticket != null && ticket.Identity != null)
                {
                    context.Authenticated(ticket.Identity, ticket.Properties.Dictionary, BaseOptions.Description.Dictionary);
                }
                else
                {
                    context.NotAuthenticated(BaseOptions.AuthenticationType, properties: null, description: BaseOptions.Description.Dictionary);
                }
            }

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