예제 #1
0
        public void TestFullAcls()
        {
            var expected = @"{""paths"":{""/*/users/**"":{},""/*/conversations/**"":{},""/*/sessions/**"":{},""/*/devices/**"":{},""/*/image/**"":{},""/*/media/**"":{},""/*/applications/**"":{},""/*/push/**"":{},""/*/knocking/**"":{}}}";
            var acls     = Acls.FullAcls();
            var json     = JsonConvert.SerializeObject(acls);

            Assert.Equal(expected, json);
        }
예제 #2
0
        public void GenerateTokenWithFullAcls()
        {
            var generator = new JwtGenerator(_mockAppId, _mockPKCS1, Acls.FullAcls());
            var expected  = @"{""paths"":{""/*/users/**"":{},""/*/conversations/**"":{},""/*/sessions/**"":{},""/*/devices/**"":{},""/*/image/**"":{},""/*/media/**"":{},""/*/applications/**"":{},""/*/push/**"":{},""/*/knocking/**"":{}}}";
            var jwt       = generator.GenerateJwt();
            var decoded   = JsonConvert.DeserializeObject <JObject>(generator.DecodeJwt(jwt));

            Assert.Equal(_mockAppId, decoded["application_id"].ToString());
            Assert.Equal(expected, Regex.Replace(decoded["acls"].ToString(), @"\s+", ""));
        }