{"action":"created","issue":{"url":"https://api.github.com/repos/Azure-Samples/media-services-v3-dotnet-tutorials/issues/10","repository_url":"https://api.github.com/repos/Azure-Samples/media-services-v3-dotnet-tutorials","labels_url":"https://api.github.com/repos/Azure-Samples/media-services-v3-dotnet-tutorials/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/Azure-Samples/media-services-v3-dotnet-tutorials/issues/10/comments","events_url":"https://api.github.com/repos/Azure-Samples/media-services-v3-dotnet-tutorials/issues/10/events","html_url":"https://github.com/Azure-Samples/media-services-v3-dotnet-tutorials/issues/10","id":372485670,"node_id":"MDU6SXNzdWUzNzI0ODU2NzA=","number":10,"title":"Unable to stream back file with Azure media service v3","user":{"login":"VickyS1993","id":35559615,"node_id":"MDQ6VXNlcjM1NTU5NjE1","avatar_url":"https://avatars1.githubusercontent.com/u/35559615?v=4","gravatar_id":"","url":"https://api.github.com/users/VickyS1993","html_url":"https://github.com/VickyS1993","followers_url":"https://api.github.com/users/VickyS1993/followers","following_url":"https://api.github.com/users/VickyS1993/following{/other_user}","gists_url":"https://api.github.com/users/VickyS1993/gists{/gist_id}","starred_url":"https://api.github.com/users/VickyS1993/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VickyS1993/subscriptions","organizations_url":"https://api.github.com/users/VickyS1993/orgs","repos_url":"https://api.github.com/users/VickyS1993/repos","events_url":"https://api.github.com/users/VickyS1993/events{/privacy}","received_events_url":"https://api.github.com/users/VickyS1993/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2018-10-22T11:39:50Z","updated_at":"2018-10-30T16:16:30Z","closed_at":null,"author_association":"NONE","body":"I Have few clarifications regarding azure media service v3\r\n\r\nMy Clarifications are,\r\n\r\nI had tried to upload a same MP4 file using azure media service v3 and v2.\r\n\r\n**01) v2 - uploads file to an asset\r\n02) v3 - uploads file to Blob and creates 0-byte asset**\r\n\r\n\r\nIs it correct, the difference between v2 and v3 are, v2 handles the file with asset and v3 handles with blob am I correct or am I doing anything wrong?\r\n\r\nif correct, then I am unable to stream back the uploaded file as it requests for a symmetric key\r\n\r\n**Exception:** (AMSV3Tutorials/EncryptWithDRM/Program.cs Line: 107 while creation locator)\r\n**Operation returned an invalid status code 'BadRequest'**\r\nStreamingLocator locator = await CreateStreamingLocatorAsync(client, ResourceGroup, AccountName, assetName, locatorName, ContentKeyPolicyName);\r\n\r\nmy requirement is,\r\n01) Upload MP4 file and encode with JWT,\r\n02) Stream back the file with JWT content protection (Key/license authorization policy)\r\nusing azure media service v3.\r\n\r\nplease help me with it.\r\n\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/Azure-Samples/media-services-v3-dotnet-tutorials/issues/comments/434367431","html_url":"https://github.com/Azure-Samples/media-services-v3-dotnet-tutorials/issues/10#issuecomment-434367431","issue_url":"https://api.github.com/repos/Azure-Samples/media-services-v3-dotnet-tutorials/issues/10","id":434367431,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDM2NzQzMQ==","user":{"login":"willzhan","id":9683803,"node_id":"MDQ6VXNlcjk2ODM4MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/9683803?v=4","gravatar_id":"","url":"https://api.github.com/users/willzhan","html_url":"https://github.com/willzhan","followers_url":"https://api.github.com/users/willzhan/followers","following_url":"https://api.github.com/users/willzhan/following{/other_user}","gists_url":"https://api.github.com/users/willzhan/gists{/gist_id}","starred_url":"https://api.github.com/users/willzhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willzhan/subscriptions","organizations_url":"https://api.github.com/users/willzhan/orgs","repos_url":"https://api.github.com/users/willzhan/repos","events_url":"https://api.github.com/users/willzhan/events{/privacy}","received_events_url":"https://api.github.com/users/willzhan/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T16:16:30Z","updated_at":"2018-10-30T16:16:30Z","author_association":"NONE","body":"In that case, let's try to replace your token generator with my code to see if it works for you.\r\n\r\npublic static Token CreateJwt(string keyType, string keyValue, string issuer, string audience, string expiry)\r\n        {\r\n            JwtPayload objJwtPayload = new JwtPayload();\r\n            //objJwtPayload.AddClaims(objList_Claim);\r\n            objJwtPayload.Add(\"groups\", new string[] { \"Paid subscriber group\", System.Configuration.ConfigurationManager.AppSettings[\"ida:EntitledGroupObjectId\"] });\r\n            //objJwtPayload.Add(\"urn:microsoft:azure:mediaservices:contentkeyidentifier\", Guid.Parse(\"47aa9945-1783-4a4c-82c1-0cafe772107c\").ToString());\r\n\r\n            SigningCredentials objSigningCredentials;\r\n\r\n            switch (keyType.ToLower())\r\n            {\r\n                case \"symmetric\":   //use symmetric key in custom STS\r\n                    byte[] symmetricKey;\r\n                    try\r\n                    {\r\n                        symmetricKey = new Guid(keyValue).ToByteArray();\r\n                    }\r\n                    catch\r\n                    {\r\n                        symmetricKey = GetBytes(keyValue);\r\n                    }\r\n                    \r\n                    objSigningCredentials = new SigningCredentials(\r\n                            new InMemorySymmetricSecurityKey(symmetricKey),\r\n                            SecurityAlgorithms.HmacSha256Signature,\r\n                            SecurityAlgorithms.Sha256Digest\r\n                            //new SymmetricSecurityKey(symmetricKey),  //v5.x\r\n                            //SecurityAlgorithms.HmacSha256\r\n                            );\r\n                    break;\r\n                case \"asymmetric\": //use asymmetric key/X509 cert in custom STS\r\n                    X509Certificate2 objX509Certificate2 = JwtUtils.GetX509Certificate2FromWebApp(System.Configuration.ConfigurationManager.AppSettings[\"sts:thumbprint\"]);\r\n                    objSigningCredentials = new X509SigningCredentials(objX509Certificate2);   //using private key\r\n                    //objSigningCredentials = new SigningCredentials(new X509SecurityKey(objX509Certificate2), SecurityAlgorithms.RsaSha256);   //v5.x\r\n                    break;\r\n                default:\r\n                    objSigningCredentials = null;\r\n                    break;\r\n            }\r\n\r\n            DateTime now = DateTime.UtcNow;\r\n            JwtSecurityToken objJwtSecurityToken = new JwtSecurityToken(issuer, audience, objJwtPayload.Claims, now.AddMinutes(-10), now.AddSeconds(double.Parse(expiry)), objSigningCredentials);\r\n\r\n            JwtSecurityTokenHandler objJwtSecurityTokenHandler = new JwtSecurityTokenHandler();\r\n            string token = objJwtSecurityTokenHandler.WriteToken(objJwtSecurityToken);\r\n\r\n            return new Token\r\n            {\r\n                TokenType = \"JWT\",\r\n                TokenValue = token\r\n            };\r\n        }"}}
{"actor":{"display_login":"willzhan"}}