示例#1
0
        public void Configure_NoServiceInfo_ReturnsDefaults()
        {
            // arrange
            var    opts    = new OpenIdConnectOptions();
            string authURL = "http://" + CloudFoundryDefaults.OAuthServiceUrl;

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

            // assert
            Assert.Equal(CloudFoundryDefaults.DisplayName, opts.AuthenticationType);
            Assert.Equal(CloudFoundryDefaults.ClientId, opts.ClientId);
            Assert.Equal(CloudFoundryDefaults.ClientSecret, opts.ClientSecret);
            Assert.Equal(new PathString(CloudFoundryDefaults.CallbackPath), opts.CallbackPath);
            Assert.Equal(authURL + CloudFoundryDefaults.CheckTokenUri, opts.TokenInfoUrl);
            Assert.True(opts.ValidateCertificates);
        }
示例#2
0
        public void Configure_WithServiceInfo_ReturnsExpected()
        {
            // arrange
            string         authURL = "http://domain";
            var            opts    = new OpenIdConnectOptions();
            SsoServiceInfo info    = new SsoServiceInfo("foobar", "clientId", "secret", "http://domain");

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

            // assert
            Assert.Equal(CloudFoundryDefaults.DisplayName, opts.AuthenticationType);
            Assert.Equal("clientId", opts.ClientId);
            Assert.Equal("secret", opts.ClientSecret);
            Assert.Equal(new PathString(CloudFoundryDefaults.CallbackPath), opts.CallbackPath);
            Assert.Equal(authURL + CloudFoundryDefaults.CheckTokenUri, opts.TokenInfoUrl);
            Assert.True(opts.ValidateCertificates);
        }
示例#3
0
        public void Configure_ObsoleteVersion_NoServiceInfo_ReturnsDefaults()
        {
            // arrange
#pragma warning disable CS0618 // Type or member is obsolete
            var opts = new OpenIDConnectOptions();
#pragma warning restore CS0618 // Type or member is obsolete
            string authURL = "http://" + CloudFoundryDefaults.OAuthServiceUrl;

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

            // assert
            Assert.Equal("PivotalSSO", opts.AuthenticationType);
            Assert.Equal(CloudFoundryDefaults.ClientId, opts.ClientId);
            Assert.Equal(CloudFoundryDefaults.ClientSecret, opts.ClientSecret);
            Assert.Equal(new PathString("/signin-oidc"), opts.CallbackPath);
            Assert.Equal(authURL + CloudFoundryDefaults.CheckTokenUri, opts.TokenInfoUrl);
            Assert.True(opts.ValidateCertificates);
        }
示例#4
0
        public void Configure_NoOptions_Throws()
        {
            var exception = Assert.Throws <ArgumentNullException>(() => OpenIdConnectConfigurer.Configure(null, null));

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