public static IServiceCollection AddSwagger( this IServiceCollection services, AuthorizationOptions authOptions, BrandingOptions brandingOptions ) { services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = brandingOptions.ApplicationName, Version = "v1", Description = "API documentation and interaction" }); options.EnableAnnotations(); if (File.Exists("IdentityServer.xml")) { options.IncludeXmlComments("IdentityServer.xml"); } }); return(services); }
public _Controller( BrandingOptions displayOptions, ILogger logger ) { Branding = displayOptions; Logger = logger; }
public ClientController( ILogger <ClientController> logger, ClientService svc, BrandingOptions branding ) : base(logger) { _svc = svc; _branding = branding; }
public ConsentController( BrandingOptions branding, ILogger <ConsentController> logger, IIdentityServerInteractionService interaction, IClientStore clientStore, ResourceService resourceStore ) : base(branding, logger) { _viewSvc = new ConsentViewService(interaction, clientStore, resourceStore, logger); }
public HomeController( HomeService clientService, BrandingOptions branding, AccountOptions authorizationOptions, ILogger <HomeController> logger ) : base(branding, logger) { _viewSvc = clientService; Options = authorizationOptions; }
public HomeService( ClientService clientSvc, IIdentityServerInteractionService interaction, IHttpContextAccessor httpContext, BrandingOptions branding ) { _clientSvc = clientSvc; _interaction = interaction; _http = httpContext; _branding = branding; }
public GrantsController( BrandingOptions branding, ILogger <GrantsController> logger, IIdentityServerInteractionService interaction, IClientStore clients, IResourceStore resources ) : base(branding, logger) { _interaction = interaction; _clients = clients; _resources = resources; }
public ResourceController( ILogger <ResourceController> logger, ResourceService svc, ImportService importSvc, IHostEnvironment env, BrandingOptions branding ) : base(logger) { _svc = svc; _importSvc = importSvc; _env = env; _branding = branding; }
public static IApplicationBuilder UseConfiguredSwagger( this IApplicationBuilder app, AuthorizationOptions authOptions, BrandingOptions brandingOptions ) { app.UseSwagger(cfg => { cfg.RouteTemplate = "api/{documentName}/openapi.json"; }); app.UseSwaggerUI(cfg => { cfg.RoutePrefix = "api"; cfg.SwaggerEndpoint(brandingOptions.PathBase + "/api/v1/openapi.json", $"{brandingOptions.ApplicationName} (v1)"); }); return(app); }
public AccountController( ILogger <AccountController> logger, AccountViewService viewSvc, CookieService cookieService, IAccountService accountSvc, ClientService clientSvc, IAppMailClient mailer, BrandingOptions branding, AccountOptions options, IDistributedCache memcache, IIdentityServerInteractionService idInteraction ) : base(branding, logger) { _viewSvc = viewSvc; _cookies = cookieService; _accountSvc = accountSvc; _clientSvc = clientSvc; _options = options; _cache = memcache; _interaction = idInteraction; _mailer = mailer; }
public static IServiceCollection AddSwagger( this IServiceCollection services, AuthorizationOptions authOptions, BrandingOptions brandingOptions ) { string xmlDoc = Assembly.GetExecutingAssembly().GetName().Name + ".xml"; services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = brandingOptions.ApplicationName, Version = "v1", Description = "API documentation and interaction" }); options.EnableAnnotations(); #if DEBUG string[] files = Directory.GetFiles("bin", xmlDoc, SearchOption.AllDirectories); if (files.Length > 0) { options.IncludeXmlComments(files[0]); } #else if (File.Exists(xmlDoc)) { options.IncludeXmlComments(xmlDoc); } #endif if (!string.IsNullOrEmpty(authOptions.Authority)) { options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, Flows = new OpenApiOAuthFlows { AuthorizationCode = new OpenApiOAuthFlow { AuthorizationUrl = new Uri( authOptions.SwaggerClient?.AuthorizationUrl ?? $"{authOptions.Authority}/connect/authorize" ), TokenUrl = new Uri( authOptions.SwaggerClient?.TokenUrl ?? $"{authOptions.Authority}/connect/token" ), Scopes = new Dictionary <string, string> { { "openid", "User Access" }, { AppConstants.Audience, "User Access" } } } }, }); options.AddSecurityRequirement(new OpenApiSecurityRequirement { { new OpenApiSecurityScheme { Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "oauth2" } }, new[] { authOptions.Audience } } }); } }); return(services); }