srs-stack
srs-stack copied to clipboard
refactor http service with authentication middleware.
What's the problem of http api authentication?
There are a lot of repeated codes in the http api hander func. https://github.com/ossrs/oryx/blob/9b475d9d52be54234d3d77383ec69f1085581c12/platform/transcript.go#L66-L78
Solution
refactor those token authentication codes to one place. There are 2 kinds of token verification.
- Token in http post body.
middlewareAuthTokenInBody - Token in url query.
middlewareAuthTokenInURL ai-talk.gois an exception, the token authentication depends room token, so keepai-talk.go.