Example #1
0
        public void Configure_WithServiceInfo_ReturnsExpected()
        {
            // arrange
            string         authURL = "http://domain";
            var            opts    = new CloudFoundryOptions();
            SsoServiceInfo info    = new SsoServiceInfo("foobar", "clientId", "secret", "http://domain");

            // act
            CloudFoundryOptionsConfigurer.Configure(info, opts);

            // assert
            Assert.Equal("clientId", opts.ClientId);
            Assert.Equal("secret", opts.ClientSecret);
            Assert.Equal(authURL + CloudFoundryDefaults.CheckTokenUri, opts.TokenInfoUrl);
            Assert.True(opts.ValidateCertificates);
        }
Example #2
0
        public void Configure_NoServiceInfo_ReturnsDefaults()
        {
            // arrange
            var    opts    = new CloudFoundryOptions();
            string authURL = "http://" + CloudFoundryDefaults.OAuthServiceUrl;

            // act
            CloudFoundryOptionsConfigurer.Configure(null, opts);

            // assert
            Assert.Equal(authURL, opts.AuthorizationUrl);
            Assert.Equal(CloudFoundryDefaults.ClientId, opts.ClientId);
            Assert.Equal(CloudFoundryDefaults.ClientSecret, opts.ClientSecret);
            Assert.Equal(authURL + CloudFoundryDefaults.CheckTokenUri, opts.TokenInfoUrl);
            Assert.True(opts.ValidateAudience);
            Assert.True(opts.ValidateCertificates);
            Assert.True(opts.ValidateIssuer);
            Assert.True(opts.ValidateLifetime);
        }
Example #3
0
        public void Configure_NoOptions_Throws()
        {
            var exception = Assert.Throws <ArgumentNullException>(() => CloudFoundryOptionsConfigurer.Configure(null, null));

            Assert.Equal("options", exception.ParamName);
        }