This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from "@angular/core"; | |
import { AuthenticationGuard } from "./authentication.guard"; | |
@NgModule({ | |
providers: [AuthenticationGuard] | |
}) | |
export class GuardsModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HTTP_INTERCEPTORS } from "@angular/common/http"; | |
import { NgModule } from "@angular/core"; | |
import { CustomHttpInterceptor } from "./http.interceptor"; | |
@NgModule({ | |
providers: [ | |
{ provide: HTTP_INTERCEPTORS, useClass: CustomHttpInterceptor, multi: true } | |
] | |
}) | |
export class InterceptorsModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SqlServerHealthCheck : IHealthCheck | |
{ | |
private readonly string _connectionString; | |
public SqlServerHealthCheck(string connectionString) | |
{ | |
_connectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString)); | |
// Use dependency injection (DI) to supply any required services to the health check. | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
... | |
// Registers health check services | |
services.AddHealthChecks() | |
.AddCheck<SqlServerHealthCheck>("sql"); | |
... | |
} | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from "@angular/core"; | |
@Injectable({ providedIn: "root" }) | |
export class ValidationService { | |
private date = /^((((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))|(((0[1-9]|[12]\d|3[01])(0[13578]|1[02])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|[12]\d|30)(0[13456789]|1[012])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|1\d|2[0-8])02((1[6-9]|[2-9]\d)?\d{2}))|(2902((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))) ?((20|21|22|23|[01]\d|\d)(([:.][0-5]\d){1,2}))?$/; | |
private decimal = /^((-?[1-9]+)|[0-9]+)(\.?|\,?)([0-9]*)$/; | |
private email = /^([a-z0-9_\.\-]{3,})@([\da-z\.\-]{3,})\.([a-z\.]{2,6})$/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from "@angular/core"; | |
@Injectable({ providedIn: "root" }) | |
export class TokenService { | |
private token = "token"; | |
clear(): void { | |
sessionStorage.removeItem(this.token); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient } from "@angular/common/http"; | |
import { Injectable } from "@angular/core"; | |
import { Router } from "@angular/router"; | |
import { TokenService } from "../core/services/token.service"; | |
import { SignInModel } from "../models/signIn.model"; | |
@Injectable({ providedIn: "root" }) | |
export class AuthenticationService { | |
constructor( | |
private readonly http: HttpClient, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
BuildWebHost(args).Run(); | |
} | |
public static IWebHost BuildWebHost(string[] args) => | |
WebHost.CreateDefaultBuilder(args) | |
.ConfigureAppConfiguration((ctx, builder) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Storage (Factory) controller | |
/// </summary> | |
[Route("api/[controller]")] | |
public class StorageFactoryController : Controller | |
{ | |
#region Fields | |
// when using single provider | |
// private readonly ILiteXBlobService _provider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
// 1. Use default configuration from appsettings.json's 'AzureBlobConfig' | |
services.AddLiteXAzureBlobService(); | |
//OR | |
// 2. Load configuration settings using options. | |
services.AddLiteXAzureBlobService(option => |