Example #1
0
        public async Task RotateAuthorizationServerKeys()
        {
            var testClient = TestClient.Create();
            var testAuthorizationServerName = $"{SdkPrefix}:Test AuthZ Server ({TestClient.RandomString(4)})";

            var testAuthorizationServer = new AuthorizationServer
            {
                Name        = testAuthorizationServerName,
                Description = "Test Authorization Server",
                Audiences   = new string[] { "api://default" },
            };
            var key = new JwkUse
            {
                Use = "sig",
            };

            var createdAuthorizationServer = await testClient.AuthorizationServers.CreateAuthorizationServerAsync(testAuthorizationServer);

            try
            {
                var keys = await createdAuthorizationServer.RotateKeys(key).ToListAsync();

                keys.Should().NotBeNull();
                keys.Count.Should().BeGreaterThan(0);
            }
            finally
            {
                await createdAuthorizationServer.DeactivateAsync();

                await testClient.AuthorizationServers.DeleteAuthorizationServerAsync(createdAuthorizationServer.Id);
            }
        }
Example #2
0
 void SetUse(JwkUse _use)
 {
     if (_use == JwkUse.enc)
     {
         use = "enc";
     }
     else if (_use == JwkUse.sig)
     {
         use = "sig";
     }
     else
     {
         throw new Exception("Invalid argument");
     }
 }