Question: Is there anyway to use a preprocess login plugin for the LoginAssistantComponent without the DBManager enabled & configured?
I am trying to write a custom authentication flow by using the Login Assistant's preprocess plugin however that throws a SQLException when the Database Manager is not configured in the AdminTool for that particular Zone. For context, I have an established service that will be used for authenticating users.
At this point, I plan on writing a custom LoginAssistantComponent that guts the SQL requirement but wanted to see if anyone else had a better idea before I went down such a path.
Custom Login
Re: Custom Login
I actually came up with a solution, figured I'd post it here in case it helps someone.
For context, these two web pages were important:
https://smartfoxserver.com/blog/how-to- ... tom-login/
http://docs2x.smartfoxserver.com/Extens ... -assistant
The problem with creating an EventHandler to manage USER_LOGIN event is that the password is hashed and I need the password unmodified to submit to my login service. That's where LoginAssistantComponent comes in, which allows you to set customPasswordCheck to true and send a custom variable to the server but that has some underlying assumptions about how the class will be used in conjunction with the SQL database (see original post).
So, after some digging, I found I was able to access that custom variable in a custom Event Handler, combining the two articles, and arrived with the following Kotlin code:
With that, I was able to throw a SFSLoginException if I needed to and everything seems to be working well.
Hope this helps and let me know if anyone sees a problem with this approach.
For context, these two web pages were important:
https://smartfoxserver.com/blog/how-to- ... tom-login/
http://docs2x.smartfoxserver.com/Extens ... -assistant
The problem with creating an EventHandler to manage USER_LOGIN event is that the password is hashed and I need the password unmodified to submit to my login service. That's where LoginAssistantComponent comes in, which allows you to set customPasswordCheck to true and send a custom variable to the server but that has some underlying assumptions about how the class will be used in conjunction with the SQL database (see original post).
So, after some digging, I found I was able to access that custom variable in a custom Event Handler, combining the two articles, and arrived with the following Kotlin code:
Code: Select all
val clientIncomingData = event.getParameter(SFSEventParam.LOGIN_IN_DATA) as ISFSObject
val password = clientIncomingData.getUtfString("passwd")
With that, I was able to throw a SFSLoginException if I needed to and everything seems to be working well.
Hope this helps and let me know if anyone sees a problem with this approach.
Who is online
Users browsing this forum: No registered users and 132 guests