mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 16:18:14 +08:00
all packages upgraded and tests passing
This commit is contained in:
@ -12,19 +12,22 @@ This will bring down everything needed by the admin API.
|
||||
Providing your own IdentityServer
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
|
||||
All you need to do to hook into your own IdentityServer is add the following to your ConfigureServices method.
|
||||
|
||||
.. code-block:: csharp
|
||||
|
||||
public virtual void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
Action<IdentityServerAuthenticationOptions> options = o => {
|
||||
// o.Authority = ;
|
||||
// o.ApiName = ;
|
||||
// etc....
|
||||
Action<JwtBearerOptions> options = o =>
|
||||
{
|
||||
o.Authority = identityServerRootUrl;
|
||||
o.RequireHttpsMetadata = false;
|
||||
o.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
ValidateAudience = false,
|
||||
};
|
||||
// etc....
|
||||
};
|
||||
|
||||
services
|
||||
.AddOcelot()
|
||||
|
@ -97,16 +97,14 @@ In order to use IdentityServer bearer tokens, register your IdentityServer servi
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
var authenticationProviderKey = "TestKey";
|
||||
Action<IdentityServerAuthenticationOptions> options = o =>
|
||||
Action<JwtBearerOptions> options = o =>
|
||||
{
|
||||
o.Authority = "https://whereyouridentityserverlives.com";
|
||||
o.ApiName = "api";
|
||||
o.SupportedTokens = SupportedTokens.Both;
|
||||
o.ApiSecret = "secret";
|
||||
// etc
|
||||
};
|
||||
|
||||
services.AddAuthentication()
|
||||
.AddIdentityServerAuthentication(authenticationProviderKey, options);
|
||||
.AddJwtBearer(authenticationProviderKey, options);
|
||||
|
||||
services.AddOcelot();
|
||||
}
|
||||
|
Reference in New Issue
Block a user