mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 20:10:50 +08:00 
			
		
		
		
	Renamed ScopeName to ApiName, ScopeSecret to ApiSecret, and
AdditionalScopes to Allowed Scoped in order to be more consistent with Identity Server naming conventions.
This commit is contained in:
		@@ -19,11 +19,11 @@ namespace Ocelot.Authentication.Handler.Creator
 | 
			
		||||
            builder.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
 | 
			
		||||
            {
 | 
			
		||||
                Authority = authOptions.ProviderRootUrl,
 | 
			
		||||
                ApiName = authOptions.ScopeName,
 | 
			
		||||
                ApiName = authOptions.ApiName,
 | 
			
		||||
                RequireHttpsMetadata = authOptions.RequireHttps,
 | 
			
		||||
                AllowedScopes = authOptions.AdditionalScopes,
 | 
			
		||||
                AllowedScopes = authOptions.AllowedScopes,
 | 
			
		||||
                SupportedTokens = SupportedTokens.Both,
 | 
			
		||||
                ApiSecret = authOptions.ScopeSecret
 | 
			
		||||
                ApiSecret = authOptions.ApiSecret
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            var authenticationNext = builder.Build();
 | 
			
		||||
 
 | 
			
		||||
@@ -4,22 +4,22 @@ namespace Ocelot.Configuration
 | 
			
		||||
{
 | 
			
		||||
    public class AuthenticationOptions
 | 
			
		||||
    {
 | 
			
		||||
        public AuthenticationOptions(string provider, string providerRootUrl, string scopeName, bool requireHttps, List<string> additionalScopes, string scopeSecret)
 | 
			
		||||
        public AuthenticationOptions(string provider, string providerRootUrl, string apiName, bool requireHttps, List<string> allowedScopes, string apiSecret)
 | 
			
		||||
        {
 | 
			
		||||
            Provider = provider;
 | 
			
		||||
            ProviderRootUrl = providerRootUrl;
 | 
			
		||||
            ScopeName = scopeName;
 | 
			
		||||
			ApiName = apiName;
 | 
			
		||||
            RequireHttps = requireHttps;
 | 
			
		||||
            AdditionalScopes = additionalScopes;
 | 
			
		||||
            ScopeSecret = scopeSecret;
 | 
			
		||||
			AllowedScopes = allowedScopes;
 | 
			
		||||
            ApiSecret = apiSecret;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string Provider { get; private set; }
 | 
			
		||||
        public string ProviderRootUrl { get; private set; }
 | 
			
		||||
        public string ScopeName { get; private set; }
 | 
			
		||||
        public string ScopeSecret { get; private set; }
 | 
			
		||||
        public string ApiName { get; private set; }
 | 
			
		||||
        public string ApiSecret { get; private set; }
 | 
			
		||||
        public bool RequireHttps { get; private set; }
 | 
			
		||||
        public List<string> AdditionalScopes { get; private set; }
 | 
			
		||||
        public List<string> AllowedScopes { get; private set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,10 +7,10 @@ namespace Ocelot.Configuration.Builder
 | 
			
		||||
 | 
			
		||||
        private string _provider;
 | 
			
		||||
        private string _providerRootUrl;
 | 
			
		||||
        private string _scopeName;
 | 
			
		||||
        private string _scopeSecret;
 | 
			
		||||
        private string _apiName;
 | 
			
		||||
        private string _apiSecret;
 | 
			
		||||
        private bool _requireHttps;
 | 
			
		||||
        private List<string> _additionalScopes;
 | 
			
		||||
        private List<string> _allowedScopes;
 | 
			
		||||
 | 
			
		||||
        public AuthenticationOptionsBuilder WithProvider(string provider)
 | 
			
		||||
        {
 | 
			
		||||
@@ -24,15 +24,15 @@ namespace Ocelot.Configuration.Builder
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public AuthenticationOptionsBuilder WithScopeName(string scopeName)
 | 
			
		||||
        public AuthenticationOptionsBuilder WithApiName(string apiName)
 | 
			
		||||
        {
 | 
			
		||||
            _scopeName = scopeName;
 | 
			
		||||
            _apiName = apiName;
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public AuthenticationOptionsBuilder WithScopeSecret(string scopeSecret)
 | 
			
		||||
        public AuthenticationOptionsBuilder WithApiSecret(string apiSecret)
 | 
			
		||||
        {
 | 
			
		||||
            _scopeSecret = scopeSecret;
 | 
			
		||||
            _apiSecret = apiSecret;
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -42,15 +42,15 @@ namespace Ocelot.Configuration.Builder
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public AuthenticationOptionsBuilder WithAdditionalScopes(List<string> additionalScopes)
 | 
			
		||||
        public AuthenticationOptionsBuilder WithAllowedScopes(List<string> allowedScopes)
 | 
			
		||||
        {
 | 
			
		||||
            _additionalScopes = additionalScopes;
 | 
			
		||||
            _allowedScopes = allowedScopes;
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public AuthenticationOptions Build()
 | 
			
		||||
        {
 | 
			
		||||
            return new AuthenticationOptions(_provider, _providerRootUrl, _scopeName, _requireHttps, _additionalScopes, _scopeSecret);
 | 
			
		||||
            return new AuthenticationOptions(_provider, _providerRootUrl, _apiName, _requireHttps, _allowedScopes, _apiSecret);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -10,10 +10,10 @@ namespace Ocelot.Configuration.Creator
 | 
			
		||||
            return new AuthenticationOptionsBuilder()
 | 
			
		||||
                                        .WithProvider(fileReRoute.AuthenticationOptions?.Provider)
 | 
			
		||||
                                        .WithProviderRootUrl(fileReRoute.AuthenticationOptions?.ProviderRootUrl)
 | 
			
		||||
                                        .WithScopeName(fileReRoute.AuthenticationOptions?.ScopeName)
 | 
			
		||||
                                        .WithApiName(fileReRoute.AuthenticationOptions?.ApiName)
 | 
			
		||||
                                        .WithRequireHttps(fileReRoute.AuthenticationOptions.RequireHttps)
 | 
			
		||||
                                        .WithAdditionalScopes(fileReRoute.AuthenticationOptions?.AdditionalScopes)
 | 
			
		||||
                                        .WithScopeSecret(fileReRoute.AuthenticationOptions?.ScopeSecret)
 | 
			
		||||
                                        .WithAllowedScopes(fileReRoute.AuthenticationOptions?.AllowedScopes)
 | 
			
		||||
                                        .WithApiSecret(fileReRoute.AuthenticationOptions?.ApiSecret)
 | 
			
		||||
                                        .Build();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,14 +6,14 @@ namespace Ocelot.Configuration.File
 | 
			
		||||
    {
 | 
			
		||||
        public FileAuthenticationOptions()
 | 
			
		||||
        {
 | 
			
		||||
            AdditionalScopes = new List<string>();
 | 
			
		||||
			AllowedScopes = new List<string>();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string Provider { get; set; }
 | 
			
		||||
        public string ProviderRootUrl { get; set; }
 | 
			
		||||
        public string ScopeName { get; set; }
 | 
			
		||||
        public string ApiName { get; set; }
 | 
			
		||||
        public bool RequireHttps { get; set; }
 | 
			
		||||
        public List<string> AdditionalScopes { get; set; }
 | 
			
		||||
        public string ScopeSecret { get; set; }
 | 
			
		||||
        public List<string> AllowedScopes { get; set; }
 | 
			
		||||
        public string ApiSecret { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user