Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authorize_key request #14

Open
looped-monk opened this issue Feb 1, 2025 · 0 comments
Open

authorize_key request #14

looped-monk opened this issue Feb 1, 2025 · 0 comments

Comments

@looped-monk
Copy link

At the outset , Its a great repo ben.

I have 2 questions for my use case with regards to the following code(attached below) which is in your repo:

My current use case is I use a Authorization token "Bearer token_here" in my headers to access my Django REST API backend for subsequent requests after the 1 request being username and password after which my backend issues the user the token for subsequent requests. So header includes the key Authorization and the value is "Bearer token_here" and the body has other variables like blog_uuid ,etc...

1 a As per the code below, I need to add the $http_authorization part of the request body ?
b As a consequence of 1.a above, If I need to maintain my existing setup($http_authorization part of headers ), How do I make changes below which includes the $http_authorization part of header? and any changes part on the Django view end (class AuthorizeKeyAccessView) ?

  1. Regarding , $cookie_sessionid , at the risk of sounding stupid, where do I obtain the value from ?
location = /authorize {
            internal;

            set_hmac_sha1 $sig $rtmp_secret "$cookie_sessionid $stream_uuid";

            if ($http_authorization) {
                set_hmac_sha1 $sig $rtmp_secret "$http_authorization $stream_uuid";
            }

            set_encode_base64 $sig $sig;

            if ($sig != $user_sig) {
                return 403;
            }

            proxy_set_header X-RTMP-Secret $rtmp_secret;
            proxy_pass https://{{ app_host }}/api/v1/authorize/$stream_uuid;
        }

        location ~ ^/keys/([^/]+)/[0-9]+\.key$ {
            set $stream_uuid $1;
            set $user_sig $arg_s;
            auth_request /authorize;
        }

        location ~ ^/live/([^/]+)/index\.m3u8$ {
            set $stream_uuid $1;
            set_hmac_sha1 $sig $rtmp_secret "$cookie_sessionid $stream_uuid";

            if ($http_authorization) {
                set_hmac_sha1 $sig $rtmp_secret "$http_authorization $stream_uuid";
            }

            set_encode_base64 $sig $sig;
            subs_filter_types application/vnd.apple.mpegurl;
            subs_filter "URI=\"/keys/([^/]+)/([0-9]+)\.key\"" "URI=\"/keys/$1/$2.key?s=$sig\"" gr;
        }
@looped-monk looped-monk changed the title http_auth authorize_key request Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant