srs-stack icon indicating copy to clipboard operation
srs-stack copied to clipboard

refactor http service with authentication middleware.

Open suzp1984 opened this issue 1 year ago • 0 comments

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.

  1. Token in http post body. middlewareAuthTokenInBody
  2. Token in url query. middlewareAuthTokenInURL
  3. ai-talk.go is an exception, the token authentication depends room token, so keep ai-talk.go.

suzp1984 avatar Nov 26 '24 12:11 suzp1984