當前位置: 首頁>>代碼示例>>C#>>正文


C# TokenRequestValidator.Validate方法代碼示例

本文整理匯總了C#中Thinktecture.AuthorizationServer.OAuth2.TokenRequestValidator.Validate方法的典型用法代碼示例。如果您正苦於以下問題:C# TokenRequestValidator.Validate方法的具體用法?C# TokenRequestValidator.Validate怎麽用?C# TokenRequestValidator.Validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Thinktecture.AuthorizationServer.OAuth2.TokenRequestValidator的用法示例。


在下文中一共展示了TokenRequestValidator.Validate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NoParameters

        public void NoParameters()
        {
            var validator = new TokenRequestValidator();
            var app = _testConfig.FindApplication("test");

            var result = validator.Validate(app, null, null);
        }
開發者ID:Excelsior-Charles,項目名稱:Thinktecture.AuthorizationServer,代碼行數:7,代碼來源:TokenRequestValidationTests.cs

示例2: EmptyParameters

        public void EmptyParameters()
        {
            var validator = new TokenRequestValidator();
            var app = _testConfig.FindApplication("test");

            var result = validator.Validate(app, new TokenRequest(), _codeClient);
        }
開發者ID:Excelsior-Charles,項目名稱:Thinktecture.AuthorizationServer,代碼行數:7,代碼來源:TokenRequestValidationTests.cs

示例3: ExpiredRefreshToken

        public void ExpiredRefreshToken()
        {
            TestTokenHandleManager handleManager =
                new TestTokenHandleManager("abc", "codeclient", "https://validredirect", expired: true);

            var validator = new TokenRequestValidator(handleManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.RefreshToken,
                Refresh_Token = "abc"
            };

            try
            {
                var result = validator.Validate(app, request, _client);
            }
            catch (TokenRequestValidationException ex)
            {
                Assert.AreEqual(OAuthConstants.Errors.InvalidGrant, ex.OAuthError);
                return;
            }

            Assert.Fail("No exception thrown.");
        }
開發者ID:pksorensen,項目名稱:Thinktecture.AuthorizationServer,代碼行數:25,代碼來源:TokenRequest_Validation_RefreshToken.cs

示例4: MissingClientId

        public void MissingClientId()
        {
            var validator = new TokenRequestValidator();
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.Password,
                UserName = "username",
                Password = "password",
                Scope = "read"
            };

            try
            {
                var client = Principal.Create("Test",
                                new Claim("password", "secret"));

                var result = validator.Validate(app, request, client);
            }
            catch (TokenRequestValidationException ex)
            {
                Assert.AreEqual(OAuthConstants.Errors.InvalidClient, ex.OAuthError);
                return;
            }

            Assert.Fail("No exception thrown.");
        }
開發者ID:Griimm,項目名稱:Thinktecture.AuthorizationServer,代碼行數:27,代碼來源:TokenRequest_Validation_General.cs

示例5: ValidRequest

        public void ValidRequest()
        {
            var validator = new TokenRequestValidator(_handleManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.RefreshToken,
                Refresh_Token = "abc"
            };

            var result = validator.Validate(app, request, _client);
        }
開發者ID:RomanDidenko,項目名稱:Thinktecture.AuthorizationServer,代碼行數:12,代碼來源:TokenRequest_Validation_RefreshToken.cs

示例6: ValidSingleScope

        public void ValidSingleScope()
        {
            var validator = new TokenRequestValidator();
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.ClientCredentials,
                Scope = "read"
            };

            var result = validator.Validate(app, request, _client);
        }
開發者ID:Griimm,項目名稱:Thinktecture.AuthorizationServer,代碼行數:12,代碼來源:TokenRequest_Validation_Client.cs

示例7: ValidCodeGrant

        public void ValidCodeGrant()
        {
            var validator = new TokenRequestValidator(new TestTokenHandleManager("codeclient", "https://todo"));
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.AuthorizationCode,
                Code = "abc",
                Redirect_Uri = "https://todo"
            };

            var result = validator.Validate(app, request, _codeClient);
        }
開發者ID:Excelsior-Charles,項目名稱:Thinktecture.AuthorizationServer,代碼行數:13,代碼來源:TokenRequestValidationTests.cs

示例8: ValidSingleScope

        public void ValidSingleScope()
        {
            var validator = new TokenRequestValidator(_clientManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = "assertion",
                Assertion = "assertion",
                Scope = "read"
            };

            var result = validator.Validate(app, request, _client);
        }
開發者ID:kahneraja,項目名稱:Thinktecture.AuthorizationServer,代碼行數:13,代碼來源:TokenRequest_Validation_Assertion.cs

示例9: ValidSingleScope

        public void ValidSingleScope()
        {
            var validator = new TokenRequestValidator(_handleManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.AuthorizationCode,
                Code = "abc",
                Redirect_Uri = "https://validredirect"
            };

            var result = validator.Validate(app, request, _client);
        }
開發者ID:Griimm,項目名稱:Thinktecture.AuthorizationServer,代碼行數:13,代碼來源:TokenRequest_Validation_Code.cs

示例10: ValidSingleScope

        public void ValidSingleScope()
        {
            var validator = new TokenRequestValidator();
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.Password,
                UserName = "username",
                Password = "password",
                Scope = "read"
            };

            var result = validator.Validate(app, request, _client);
        }
開發者ID:Griimm,項目名稱:Thinktecture.AuthorizationServer,代碼行數:14,代碼來源:TokenRequest_Validation_Password.cs

示例11: MissingScope

        public void MissingScope()
        {
            var validator = new TokenRequestValidator();
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.ClientCredentials,
            };

            try
            {
                var result = validator.Validate(app, request, _client);
            }
            catch (TokenRequestValidationException ex)
            {
                Assert.AreEqual(OAuthConstants.Errors.InvalidScope, ex.OAuthError);
                return;
            }

            Assert.Fail("No exception thrown.");
        }
開發者ID:Griimm,項目名稱:Thinktecture.AuthorizationServer,代碼行數:21,代碼來源:TokenRequest_Validation_Client.cs

示例12: MissingCode

        public void MissingCode()
        {
            var validator = new TokenRequestValidator(_handleManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.RefreshToken,
            };

            try
            {
                var result = validator.Validate(app, request, _client);
            }
            catch (TokenRequestValidationException ex)
            {
                Assert.AreEqual(OAuthConstants.Errors.InvalidGrant, ex.OAuthError);
                return;
            }

            Assert.Fail("No exception thrown.");
        }
開發者ID:RomanDidenko,項目名稱:Thinktecture.AuthorizationServer,代碼行數:21,代碼來源:TokenRequest_Validation_RefreshToken.cs

示例13: MissingScope

        public void MissingScope()
        {
            var validator = new TokenRequestValidator(_clientManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.Password,
                UserName = "JohnSmith",
                Password = "12345678",
            };

            try
            {
                var result = validator.Validate(app, request, _client);
            }
            catch (TokenRequestValidationException ex)
            {
                Assert.AreEqual(OAuthConstants.Errors.InvalidScope, ex.OAuthError);
                return;
            }

            Assert.Fail("No exception thrown.");
        }
開發者ID:kahneraja,項目名稱:Thinktecture.AuthorizationServer,代碼行數:23,代碼來源:TokenRequest_Validation_Password.cs

示例14: NonMatchingRedirectUri

        public void NonMatchingRedirectUri()
        {
            var validator = new TokenRequestValidator(_handleManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = OAuthConstants.GrantTypes.AuthorizationCode,
                Code = "abc",
                Redirect_Uri = "https://invalidredirect"
            };

            try
            {
                var result = validator.Validate(app, request, _client);
            }
            catch (TokenRequestValidationException ex)
            {
                Assert.AreEqual(OAuthConstants.Errors.InvalidRequest, ex.OAuthError);
                return;
            }

            Assert.Fail("No exception thrown.");
        }
開發者ID:Griimm,項目名稱:Thinktecture.AuthorizationServer,代碼行數:23,代碼來源:TokenRequest_Validation_Code.cs

示例15: UnknownScope

        public void UnknownScope()
        {
            var validator = new TokenRequestValidator(_clientManager);
            var app = _testConfig.FindApplication("test");
            var request = new TokenRequest
            {
                Grant_Type = "assertion",
                Assertion = "assertion",
                Scope = "unknown"
            };

            try
            {
                var result = validator.Validate(app, request, _client);
            }
            catch (TokenRequestValidationException ex)
            {
                Assert.AreEqual(OAuthConstants.Errors.InvalidScope, ex.OAuthError);
                return;
            }

            Assert.Fail("No exception thrown.");
        }
開發者ID:kahneraja,項目名稱:Thinktecture.AuthorizationServer,代碼行數:23,代碼來源:TokenRequest_Validation_Assertion.cs


注:本文中的Thinktecture.AuthorizationServer.OAuth2.TokenRequestValidator.Validate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。