|  |  | @ -30,74 +30,30 @@ builder.Services.AddScoped<ISalesInterface, SalesService>(); | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddScoped<IUser, UserService>(); | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddScoped<ICustomer, CustomerService>(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | //builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>
 | 
			
		
	
		
			
				
					|  |  |  | //{
 | 
			
		
	
		
			
				
					|  |  |  | //    options.RequireHttpsMetadata = false;
 | 
			
		
	
		
			
				
					|  |  |  | //    options.SaveToken = true;
 | 
			
		
	
		
			
				
					|  |  |  | //    options.TokenValidationParameters = new TokenValidationParameters()
 | 
			
		
	
		
			
				
					|  |  |  | //    {
 | 
			
		
	
		
			
				
					|  |  |  | //        ValidateIssuer = true,
 | 
			
		
	
		
			
				
					|  |  |  | //        ValidateAudience = true,
 | 
			
		
	
		
			
				
					|  |  |  | //        ValidAudience = builder.Configuration["Jwt:Audience"],
 | 
			
		
	
		
			
				
					|  |  |  | //        ValidIssuer = builder.Configuration["Jwt:Issuer"],
 | 
			
		
	
		
			
				
					|  |  |  | //        IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Key"]))
 | 
			
		
	
		
			
				
					|  |  |  | //    };
 | 
			
		
	
		
			
				
					|  |  |  | //});
 | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddSwaggerGen(c => | 
			
		
	
		
			
				
					|  |  |  | // Add services to the container.
 | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddControllers(); | 
			
		
	
		
			
				
					|  |  |  | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
 | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddEndpointsApiExplorer(); | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddSwaggerGen(); | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddCors(options => | 
			
		
	
		
			
				
					|  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |     c.SwaggerDoc("v1", new OpenApiInfo { Title = "MyBlazor", Version = "v1" }); | 
			
		
	
		
			
				
					|  |  |  |     c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         In = ParameterLocation.Header, | 
			
		
	
		
			
				
					|  |  |  |         Description = "Please enter a valid token", | 
			
		
	
		
			
				
					|  |  |  |         Name = "Authorization", | 
			
		
	
		
			
				
					|  |  |  |         Type = SecuritySchemeType.Http, | 
			
		
	
		
			
				
					|  |  |  |         BearerFormat = "JWT", | 
			
		
	
		
			
				
					|  |  |  |         Scheme = "Bearer" | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |     c.AddSecurityRequirement(new OpenApiSecurityRequirement | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |             new OpenApiSecurityScheme | 
			
		
	
		
			
				
					|  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |                 Reference = new OpenApiReference | 
			
		
	
		
			
				
					|  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |                     Type=ReferenceType.SecurityScheme, | 
			
		
	
		
			
				
					|  |  |  |                     Id="Bearer" | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             }, | 
			
		
	
		
			
				
					|  |  |  |             new string[]{} | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |     options.AddPolicy("CorsPolicy", | 
			
		
	
		
			
				
					|  |  |  |         builder => builder.AllowAnyOrigin() | 
			
		
	
		
			
				
					|  |  |  |         .AllowAnyMethod() | 
			
		
	
		
			
				
					|  |  |  |         .AllowAnyHeader() | 
			
		
	
		
			
				
					|  |  |  |         ); | 
			
		
	
		
			
				
					|  |  |  | }); | 
			
		
	
		
			
				
					|  |  |  | builder.Services.AddControllersWithViews(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | var app = builder.Build(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | // Configure the HTTP request pipeline.
 | 
			
		
	
		
			
				
					|  |  |  | if (app.Environment.IsDevelopment()) | 
			
		
	
		
			
				
					|  |  |  | { | 
			
		
	
		
			
				
					|  |  |  | app.UseSwagger(); | 
			
		
	
		
			
				
					|  |  |  | app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SecureSwagger v1")); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     app.UseSwagger(); | 
			
		
	
		
			
				
					|  |  |  |     app.UseSwaggerUI(c => | 
			
		
	
		
			
				
					|  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |         c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyBlazor v1"); | 
			
		
	
		
			
				
					|  |  |  |         c.RoutePrefix = "api/docs"; | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | else | 
			
		
	
		
			
				
					|  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |     app.UseExceptionHandler("/Error"); | 
			
		
	
		
			
				
					|  |  |  |     // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
 | 
			
		
	
		
			
				
					|  |  |  |     app.UseHsts(); | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | app.UseHttpsRedirection(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | app.UseRouting(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | app.UseCors("CorsPolicy"); | 
			
		
	
		
			
				
					|  |  |  | app.UseAuthentication(); | 
			
		
	
		
			
				
					|  |  |  | app.UseAuthorization(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | app.MapControllers(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | app.Run(); | 
			
		
	
		
			
				
					|  |  |  | app.Run(); |