예제 #1
0
        public async Task When_Registering_A_Client_Then_No_Exception_Is_Thrown()
        {
            var tokenClient = new TokenClient(
                TokenCredentials.FromClientCredentials("stateless_client", "stateless_client"),
                _server.Client,
                new Uri($"{BaseUrl}/.well-known/openid-configuration"));
            var grantedToken =
                await tokenClient.GetToken(TokenRequest.FromScopes("manager")).ConfigureAwait(false) as
                Option <GrantedTokenResponse> .Result;

            var registrationClient = await ManagementClient.Create(
                _server.Client,
                new Uri($"{BaseUrl}/.well-known/openid-configuration"))
                                     .ConfigureAwait(false);

            var client = await registrationClient.Register(
                new Client
            {
                JsonWebKeys     = TestKeys.SecretKey.CreateSignatureJwk().ToSet(),
                AllowedScopes   = new[] { "openid" },
                ClientName      = "Test",
                ClientId        = "id",
                RedirectionUrls = new[] { new Uri("https://localhost"), },
                RequestUris     = new[] { new Uri("https://localhost") },
            },
                grantedToken.Item.AccessToken)
                         .ConfigureAwait(false) as Option <Client> .Result;

            Assert.NotNull(client);
        }
예제 #2
0
 public ResourceOwnerFixture()
 {
     _server = new TestManagerServerFixture();
     _resourceOwnerClient = ManagementClient.Create(
         _server.Client,
         new Uri(LocalhostWellKnownOpenidConfiguration))
                            .Result;
 }
예제 #3
0
 public static ManagementClient GetClient()
 {
     return(ManagementClient.Create(
                clientRootUrl,
                clientId,
                clientSharedSecret
                ));
 }
예제 #4
0
        public ObjectInstance CreateMBean(string className, ObjectName name, object[] arguments)
        {
            var request = new DynamicMBeanResourceConstructor
            {
                RegistrationParameters =
                    arguments.Select(x => new ParameterType(null, x)).ToArray(),
                ResourceClass = className,
                ResourceEPR   = ObjectNameSelector.CreateEndpointAddress(name)
            };
            var objectName = _manClient.Create(Schema.MBeanServerResourceUri, request).ExtractObjectName();

            return(new ObjectInstance(objectName, null));
        }
예제 #5
0
 public ClientFixture()
 {
     _server        = new TestManagerServerFixture();
     _openidClients = ManagementClient.Create(_server.Client, new Uri(OpenidmanagerConfiguration)).Result;
 }