Freeswitch JWT Integration
It seems that the following solution should be used.
In order to allow FS work with JWT for authentication it is necessary to send JWT inside the custom header from the user agent to the FS. Also it is important to put some known password to the user agent.
When UA is connecting to the FS and when building dynamically the directory using lua script (xml-handler-script, xml-handler-bindings) it is possible to validate the JWT and provide the right directory entry for the user simply by reading the custom-header fields.
If JWT was valid then correct password (known one) will be used to allow FS to proceed with that, otherwise - another non valid password will be provided and FS will drop the connection.
Hope that helps to somebody,
I am trying to make an integration between a sip client and FS system. SIP Client sends a JWT token as a password during the authentication stage.
In order to authenticate a client, FS creates a directory entry with the password field and compares it to the password received from the client, in my case I need to override this behaviour by getting the "token" which appears as password, verifying it and returning the answer to FS about the result of the verification so it will know whether to accept or to reject the user.
I am not sure how to override this behaviour in FS without change of the source code. I would prefer to write a python or lua plugins to deal with that.
Many thanks,