Autocomplete bypass checking for authentication token which result in confusing state after token expires.

1 Answer 102 Views
AutoComplete General Discussions
Salma
Top achievements
Rank 1
Iron
Salma asked on 30 Jan 2023, 08:07 AM

 am using Azure Ad authentication in my ASP.Net 4.8 MVC application. When authentication is expired and when user clicks on the link or button user get redirected to login page. So that is good.

However, I have a problem with AutoComplete textbox which is also available on the same page among buttons and link. If user leave the app open and comes back after page authentication cookie is expired and enter a value in autocomplete textbox, then textbox doesn't do anything, it works as there is no data to filter and doesn't even throw an error. I would expect it to redirect user to login page or refresh the token.

I suppose that could be known to those who uses Jquery or ajax functions or telerik controls to how to check for token. I am just new to all that.

Just in case if the code is needed so here it is.

  <form action="@Url.Action("Transaction", "Job")" method="POST">
            <div>
                <div class="col-xs-4 k-content py text-left">

                    @{
                        try
                        {
                            @(Html.Kendo().AutoComplete()
                    .Name("searchValue")  //chaninging the name of the class to UserModel
                    .DataTextField("SearchString") //DataTextField("dataField")
                    .Filter("contains")
                    .MinLength(2)

                    .HtmlAttributes(new {style = "width:100%"})
                    .DataSource(source =>
                    {
                        source.Read(read =>
                        {

                            read.Action("GetAutoComplete", "Job")
                                .Data("onAdditionalData");
                        })
                            .ServerFiltering(true);
                    })
                    //.Events(e => e.DataBound("onDataBound"))
                    )

                        }
                        catch (Exception e)
                        {
                            //this.RedirectToAction("Reporting", "ReportManagement");
                        }

                    }

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 01 Feb 2023, 12:05 PM

Hello Salma,

Thank you for the code snippet and details provided.

As I can see from the code, the AutoComplete is using Server Filtering as in the following Demo:

This means that every change of the input will execute a request to an Action Method in the Controller. The following check should happen there - if the user is currently logged in - execute the server filtering of the AutoComplete. If no user is logged in - redirect to the login page.

I hope this information helps. Let me know if further assistance is needed.

Kind Regards,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
AutoComplete General Discussions
Asked by
Salma
Top achievements
Rank 1
Iron
Answers by
Anton Mironov
Telerik team
Share this question
or