Beispiel #1
0
        public static void PostConfigure_Throws_If_Domain_Is_Invalid(string value)
        {
            // Arrange
            string name   = "Okta";
            var    target = new OktaPostConfigureOptions();

            var options = new OktaAuthenticationOptions()
            {
                Domain = value,
            };

            // Act and Assert
            Assert.Throws <ArgumentException>("options", () => target.PostConfigure(name, options));
        }
Beispiel #2
0
        public static void PostConfigure_Configures_Valid_Endpoints(string domain)
        {
            // Arrange
            string name   = "Okta";
            var    target = new OktaPostConfigureOptions();

            var options = new OktaAuthenticationOptions()
            {
                Domain = domain,
            };

            // Act
            target.PostConfigure(name, options);

            // Assert
            options.AuthorizationEndpoint.ShouldStartWith("https://okta.local/oauth2/default/v1/");
            Uri.TryCreate(options.AuthorizationEndpoint, UriKind.Absolute, out var _).ShouldBeTrue();

            options.TokenEndpoint.ShouldStartWith("https://okta.local/oauth2/default/v1/");
            Uri.TryCreate(options.TokenEndpoint, UriKind.Absolute, out var _).ShouldBeTrue();

            options.UserInformationEndpoint.ShouldStartWith("https://okta.local/oauth2/default/v1/");
            Uri.TryCreate(options.UserInformationEndpoint, UriKind.Absolute, out var _).ShouldBeTrue();
        }