public void OAuth2Settings_Validate_RequiresCredentialProviderForClientCredentialsGrant()
        {
            var settings = new OAuth2Settings();

            settings.GrantType                = OAuth2GrantTypes.ClientCredentials;
            settings.AccessTokenUrl           = new Uri("http://testsite.com/access_token");
            settings.AuthorizeUrl             = new Uri("http://testsite.com/authorize");
            settings.RedirectUrl              = new Uri("http://testsite.com/redirect");
            settings.ClientCredentialProvider = null;

            settings.Validate();
        }
        public void OAuth2Settings_Validate_ThrowsOnNullAuthorizeUrl()
        {
            var settings = new OAuth2Settings();

            settings.GrantType                = OAuth2GrantTypes.AuthorizationCode;
            settings.AccessTokenUrl           = new Uri("http://testsite.com/access_token");
            settings.AuthorizeUrl             = null;
            settings.RedirectUrl              = new Uri("http://testsite.com/redirect");
            settings.RequestAuthentication    = (authUri) => { return(Task.FromResult(new AuthorisationCodeResponse())); };
            settings.ClientCredentialProvider = new SimpleCredentialProvider(new SimpleCredentials()
            {
                Secret = "A", Identifier = "B"
            });

            settings.Validate();
        }
        public void OAuth2Settings_Validate_RequiresAuthenticationCallbackForAuthorizationGrant()
        {
            var settings = new OAuth2Settings();

            settings.GrantType                = OAuth2GrantTypes.AuthorizationCode;
            settings.AccessTokenUrl           = new Uri("http://testsite.com/access_token");
            settings.AuthorizeUrl             = new Uri("http://testsite.com/authorize");
            settings.RedirectUrl              = new Uri("http://testsite.com/redirect");
            settings.ClientCredentialProvider = new SimpleCredentialProvider(new SimpleCredentials()
            {
                Secret = "A", Identifier = "B"
            });
            settings.RequestAuthentication = null;

            settings.Validate();
        }