Esempio n. 1
0
        public void Can_CalculateFullRedirectUri_WithDefaults()
        {
            // arrange
            var options        = new OpenIdConnectOptions();
            var requestContext = OwinTestHelpers.CreateRequest("GET", string.Empty);

            // act
            var redirectUri = UriUtility.CalculateFullRedirectUri(options, requestContext.Request);

            // assert
            Assert.StartsWith(options.AuthDomain, redirectUri);
            Assert.Contains("response_type=code", redirectUri);
            Assert.Contains("scope=openid", redirectUri);
            Assert.EndsWith("redirect_uri=" + WebUtility.UrlEncode("http://localhost" + CloudFoundryDefaults.CallbackPath), redirectUri);
        }
Esempio n. 2
0
        public void OriginalCallbackUri_Not_Changed()
        {
            // arrange
#pragma warning disable CS0618 // Type or member is obsolete
            var options = new OpenIDConnectOptions();
#pragma warning restore CS0618 // Type or member is obsolete
            var requestContext = OwinTestHelpers.CreateRequest("GET", string.Empty);

            // act
            var redirectUri = UriUtility.CalculateFullRedirectUri(options, requestContext.Request);

            // assert
            Assert.StartsWith(options.AuthDomain, redirectUri);
            Assert.Contains("response_type=code", redirectUri);
            Assert.Contains("scope=openid", redirectUri);
            Assert.EndsWith("redirect_uri=" + WebUtility.UrlEncode("http://localhost/signin-oidc"), redirectUri);
        }
Esempio n. 3
0
        public void Can_CalculateFullRedirectUri_WithNonDefaults()
        {
            // arrange
            var options = new OpenIdConnectOptions
            {
                AuthDomain   = "my_oauth_server",
                CallbackPath = new PathString("/something_else")
            };
            var requestContext = OwinTestHelpers.CreateRequest("GET", string.Empty, "https", "some_server", 1234);

            // act
            var redirectUri = UriUtility.CalculateFullRedirectUri(options, requestContext.Request);

            // assert
            Assert.StartsWith(options.AuthDomain, redirectUri);
            Assert.Contains("response_type=code", redirectUri);
            Assert.Contains("scope=openid", redirectUri);
            Assert.EndsWith("redirect_uri=" + WebUtility.UrlEncode("https://some_server:1234/something_else"), redirectUri);
        }