API
Version 7.x > API > Custom Authenticate FailureText View modes: 
User avatar
Member
Member
nrussell - 12/17/2013 5:10:45 PM
   
Custom Authenticate FailureText
We have implemented custom authentication on our Kentico Website using the Authenticate Handler. This works fine but I would like to handle a couple of different failure cases to provide more meaningful error messages.
Typically with the .Net Login control I would just set the FailureText on the control during my Authentication handler and fail the login. Within Kentico the OnAuthenticate method there is no way to access the Login control and the AuthenticationEventArgs don't seem to contain mechanism for passing back the failure reason.

Is there anyway to handle this?

User avatar
Kentico MVP
Kentico MVP
Brenden Kehren - 12/18/2013 4:24:44 PM
   
RE:Custom Authenticate FailureText
Do you have a webpart or something you've created? How do you know on the front side the login or authentication has failed? Should be able to modify your method to return a string or value of some sort and display it on the page/webpart.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/19/2013 1:21:14 AM
   
RE:Custom Authenticate FailureText
Hi,

Thank you for your message.

FroggEye has a good point, you surely are displaying the textboxes somewhere on the frontpage, is that correct? You should be able to determin whether the login was successfull or not and based on this result perform your action -> Display error message.

Kind regards,
Richard Sustek

User avatar
Member
Member
nrussell - 12/19/2013 4:05:18 PM
   
RE:Custom Authenticate FailureText
We are just using the standard Kentico LoginForm webpart. The problem I have is that the Kentico Authentication hook doesn't have any obvious way to access or pass anything back to the page that is currently executing. All I can do is either set authenticationEventArgs.User or not and that results in a success or failure.

Neil

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/20/2013 2:34:35 AM
   
RE:Custom Authenticate FailureText
Hi,

Im quite lost. You said that you implemented custom authentication.. Our login webpart is intended to be used for our CMS authentication.

Since we have a little information of how it works I would point to some chapters in our dev guide which can help you with custom authentication.

http://devnet.kentico.com/docs/7_0rc/devguide/index.html?authentication.htm
http://devnet.kentico.com/docs/7_0rc/devguide/index.html?security_handler.htm

Kind regards,
Richard Sustek

User avatar
Kentico MVP
Kentico MVP
Brenden Kehren - 12/20/2013 8:07:04 AM
   
RE:Custom Authenticate FailureText
In your Authenticate_Execute event, can't you simply throw a new exception? This should bubble up. You might need to look at maybe throwing a different exception but this should work.