diff --git a/AzureAuthStore.cs b/AzureAuthStore.cs index 81edde3..c1c8a48 100644 --- a/AzureAuthStore.cs +++ b/AzureAuthStore.cs @@ -1,58 +1,94 @@ // *********************************************************************** // Assembly : FCS.Lib.Azure -// Author : FH -// Created : 05-10-2022 -// -// Last Modified By : FH -// Last Modified On : 05-10-2022 +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 // *********************************************************************** -// -// Copyright (C) 2022 FCS Frede's Computer Services. -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see [https://www.gnu.org/licenses] +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] // // // *********************************************************************** -namespace FCS.Lib.Azure +namespace FCS.Lib.Azure; + +public class AzureAuthStore { - public class AzureAuthStore + /// + /// Azure Auth Store Constructor + /// + /// + /// + /// + /// + /// + /// + /// + public AzureAuthStore( + string azureLoginUrl, string azureOAuthEndpoint, string azureTenantId, + string azureClientId, string azureGrantType, string azureClientSecret, + string azureLoginScope) { - public AzureAuthStore( - string azureLoginUrl, string azureOAuthEndpoint, string azureTenantId, - string azureClientId, string azureGrantType, string azureSecret, - string azureLoginScope) - { - AzureLoginUrl = azureLoginUrl; - AzureOAuthEndpoint = azureOAuthEndpoint; - AzureTenantId = azureTenantId; - AzureClientId = azureClientId; - AzureGrantType = azureGrantType; - AzureSecret = azureSecret; - AzureLoginScope = azureLoginScope; - } + AzureLoginUrl = azureLoginUrl; + AzureOAuthEndpoint = azureOAuthEndpoint; + AzureTenantId = azureTenantId; + AzureClientId = azureClientId; + AzureGrantType = azureGrantType; + AzureClientSecret = azureClientSecret; + AzureLoginScope = azureLoginScope; + } - protected string AzureLoginUrl { get; set; } - protected string AzureOAuthEndpoint { get; set; } - protected string AzureTenantId { get; } - public string AzureClientId { get; } - public string AzureGrantType { get; } - public string AzureSecret { get; } - public string AzureLoginScope { get; } + /// + /// Azure Client Id + /// + public string AzureClientId { get; } - public string AzureTokenEndpoint() - { - return $"{AzureLoginUrl}/{AzureTenantId}/{AzureOAuthEndpoint}"; - } + /// + /// Azure Client Secret + /// + public string AzureClientSecret { get; } + + /// + /// Azure Grant Type + /// + public string AzureGrantType { get; } + + /// + /// Azure Login Scope + /// + public string AzureLoginScope { get; } + + /// + /// Azure Login Url + /// + protected string AzureLoginUrl { get; set; } + + /// + /// Azure OAuth Endpoint + /// + protected string AzureOAuthEndpoint { get; set; } + + /// + /// Azure Tenant Id + /// + protected string AzureTenantId { get; } + + public string AzureTokenEndpoint() + { + return $"{AzureLoginUrl}/{AzureTenantId}/{AzureOAuthEndpoint}"; } } \ No newline at end of file diff --git a/AzureConfigStore.cs b/AzureConfigStore.cs index 1d49b39..9c518eb 100644 --- a/AzureConfigStore.cs +++ b/AzureConfigStore.cs @@ -1,36 +1,114 @@ -namespace FCS.Lib.Azure; +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +namespace FCS.Lib.Azure; public class AzureConfigStore { - public AzureConfigStore(string baseUrl, string tenantId, string environment, - string api, string apiGroup, string apiVersion, + /// + /// Azure Config Store Constructor + /// + /// + /// + /// + /// + /// + /// + /// + /// + public AzureConfigStore( + string baseUrl, string tenantId, string environment, + string apiPublisher, string apiGroup, string apiVersion, string ledgerId, string oDataVersion) { BaseUrl = baseUrl; TenantId = tenantId; Environment = environment; - Api = api; + ApiPublisher = apiPublisher; ApiGroup = apiGroup; ApiVersion = apiVersion; LedgerId = ledgerId; ODataVersion = oDataVersion; } - protected string BaseUrl { get; set; } - protected string TenantId { get; } - protected string Environment { get; set; } - protected string Api { get; set; } + /// + /// Azure Api Group + /// protected string ApiGroup { get; set; } + + /// + /// Azure Api + /// + protected string ApiPublisher { get; set; } + + /// + /// Azure Api Group + /// protected string ApiVersion { get; set; } + + /// + /// Azure Base Url + /// + protected string BaseUrl { get; set; } + + /// + /// Azure Ledger Id + /// protected string LedgerId { get; set; } + + /// + /// Azure ODate Version + /// protected string ODataVersion { get; set; } - public string InnoClientApiEndpoint() + /// + /// Azure Environment + /// + protected string Environment { get; set; } + + /// + /// Azure Tenant Id + /// + protected string TenantId { get; } + + /// + /// Azure Client Api Endpoint + /// + /// + public string AzureClientApiEndpoint() { - return $"{BaseUrl}/{TenantId}/{Environment}/api/{Api}/{ApiGroup}/{ApiVersion}/companies({LedgerId})"; + return + $"{BaseUrl}/{TenantId}/{Environment}/api/{ApiPublisher}/{ApiGroup}/{ApiVersion}/companies({LedgerId})"; } - public string InnoClientOAuthEndpoint() + /// + /// Azure OAuth Endpoint + /// + /// + public string AzureClientOAuthEndpoint() { return $"{BaseUrl}/{TenantId}/{Environment}/{ODataVersion}/Company('{LedgerId}')"; } diff --git a/AzureToken.cs b/AzureToken.cs new file mode 100644 index 0000000..3fc69c2 --- /dev/null +++ b/AzureToken.cs @@ -0,0 +1,55 @@ +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +namespace FCS.Lib.Azure; + +public class AzureToken +{ + /// + /// Token Type + /// + public string TokenType { get; set; } = ""; + + /// + /// Access Token + /// + public string AccessToken { get; set; } = ""; + + /// + /// Expires + /// + public long Expires { get; set; } + + /// + /// Token Has Expired + /// + /// + /// + public bool HasExpired(long timestamp) + { + return timestamp > Expires; + } +} \ No newline at end of file diff --git a/AzureTokenDto.cs b/AzureTokenDto.cs new file mode 100644 index 0000000..7205e45 --- /dev/null +++ b/AzureTokenDto.cs @@ -0,0 +1,56 @@ +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +using System.Text.Json.Serialization; + +namespace FCS.Lib.Azure; + +public class AzureTokenDto +{ + /// + /// Token Type + /// + [JsonPropertyName("token_type")] + public string TokenType { get; set; } + + /// + /// Expires In + /// + [JsonPropertyName("expires_in")] + public long ExpiresIn { get; set; } + + /// + /// Ext Expires In + /// + [JsonPropertyName("ext_expires_in")] + public long ExtExpiresIn { get; set; } + + /// + /// Access Token + /// + [JsonPropertyName("access_token")] + public string AccessToken { get; set; } +} \ No newline at end of file diff --git a/AzureTokenFetcher.cs b/AzureTokenFetcher.cs index 8cc10b3..f62cfc8 100644 --- a/AzureTokenFetcher.cs +++ b/AzureTokenFetcher.cs @@ -1,48 +1,59 @@ // *********************************************************************** // Assembly : FCS.Lib.Azure -// Author : FH -// Created : 05-10-2022 -// -// Last Modified By : FH -// Last Modified On : 05-10-2022 +// Author : +// Created : 2023 10 02 13:25 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 // *********************************************************************** -// -// Copyright (C) 2022 FCS Frede's Computer Services. -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see [https://www.gnu.org/licenses] +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] // // // *********************************************************************** using System.Threading.Tasks; -using FCS.Contracts; -using FCS.Lib.Common; +using FCS.Lib.Azure; +namespace Inno.Azure; -namespace FCS.Lib.Azure +/// +/// Implements IAzureTokenFetcher +/// +public class AzureTokenFetcher : IAzureTokenFetcher { - public class AzureTokenFetcher : IAzureTokenFetcher + private readonly AzureAuthStore _config; + + /// + /// Construct a new Azure Token Fetcher from configuration + /// + /// + public AzureTokenFetcher(AzureAuthStore config) { - private readonly AzureAuthStore _config; - public AzureTokenFetcher(AzureAuthStore config) - { - _config = config; - } - - public async Task FetchAzureToken() - { - var result = await AzureTokenHttpRequest.RequestTokenAsync(_config).ConfigureAwait(true); - return !result.IsSuccessStatusCode ? new AzureToken{Expires = -1} : new AzureTokenMapper().MapAzureToken(result.Message); - } + _config = config; + } + + /// + /// Fetch Azure Token + /// + /// + public async Task FetchAzureToken() + { + var result = await AzureTokenHttpRequest.RequestTokenAsync(_config).ConfigureAwait(true); + return !result.IsSuccessStatusCode + ? new AzureToken { Expires = -1 } + : new AzureTokenMapper().MapAzureToken(result.Message); } } \ No newline at end of file diff --git a/AzureTokenHttpRequest.cs b/AzureTokenHttpRequest.cs index de8644c..2d87893 100644 --- a/AzureTokenHttpRequest.cs +++ b/AzureTokenHttpRequest.cs @@ -1,38 +1,63 @@ -using System.Collections.Generic; +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 02 13:19 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; -using Inno.Business.Models.Common; +using FCS.Lib.Common; -namespace Inno.Azure +namespace FCS.Lib.Azure; + +public class AzureTokenHttpRequest { - public class AzureTokenHttpRequest + public static async Task RequestTokenAsync(AzureAuthStore auth) { - public static async Task RequestTokenAsync(AzureAuthStore auth) + var credentials = new Dictionary { - var credentials = new Dictionary - { - { "grant_type", auth.AzureGrantType }, - { "client_id", auth.AzureClientId }, - { "client_secret", auth.AzureSecret }, - { "scope", auth.AzureLoginScope } - }; + { "grant_type", auth.AzureGrantType }, + { "client_id", auth.AzureClientId }, + { "client_secret", auth.AzureClientSecret }, + { "scope", auth.AzureLoginScope } + }; - using var client = new HttpClient(); - //using var azureRequest = new HttpRequestMessage(HttpMethod.Post, auth.AzureTokenEndpoint()); - //azureRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); - var content = new FormUrlEncodedContent(credentials); + using var client = new HttpClient(); + //using var azureRequest = new HttpRequestMessage(HttpMethod.Post, auth.AzureTokenEndpoint()); + //azureRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + var content = new FormUrlEncodedContent(credentials); - // todo - check for network connection - mitigate server fail - var responseMessage = await client.PostAsync(auth.AzureTokenEndpoint(), content).ConfigureAwait(true); + // todo - check for network connection - mitigate server fail + var responseMessage = await client.PostAsync(auth.AzureTokenEndpoint(), content).ConfigureAwait(true); - var azureResponse = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(true); + var azureResponse = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(true); - return new ResponseView - { - Code = responseMessage.StatusCode, - IsSuccessStatusCode = responseMessage.IsSuccessStatusCode, - Message = azureResponse - }; - } + return new HttpResponseView + { + Code = responseMessage.StatusCode, + IsSuccessStatusCode = responseMessage.IsSuccessStatusCode, + Message = azureResponse + }; } } \ No newline at end of file diff --git a/AzureTokenMapper.cs b/AzureTokenMapper.cs index 034417d..f4bfab6 100644 --- a/AzureTokenMapper.cs +++ b/AzureTokenMapper.cs @@ -1,51 +1,50 @@ // *********************************************************************** // Assembly : FCS.Lib.Azure -// Author : FH -// Created : 05-08-2022 -// -// Last Modified By : FH -// Last Modified On : 05-10-2022 +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 // *********************************************************************** -// -// Copyright (C) 2022 FCS Frede's Computer Services. -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see [https://www.gnu.org/licenses] +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] // // // *********************************************************************** - using System; using System.Text.Json; -using FCS.Lib.Common; using FCS.Lib.Utility; -namespace FCS.Lib.Azure -{ - public class AzureTokenMapper - { - public AzureToken MapAzureToken(string json) - { - if(string.IsNullOrWhiteSpace(json)) - throw new ArgumentNullException(nameof(json)); +namespace FCS.Lib.Azure; - var token = JsonSerializer.Deserialize(json); - return token == null ? null : new AzureToken +public class AzureTokenMapper +{ + public AzureToken MapAzureToken(string json) + { + if (string.IsNullOrWhiteSpace(json)) + throw new ArgumentNullException(nameof(json)); + + var token = JsonSerializer.Deserialize(json); + return token == null + ? null + : new AzureToken { AccessToken = token.AccessToken, Expires = Mogrify.CurrentDateTimeToTimeStamp() + token.ExtExpiresIn - 600, TokenType = token.TokenType }; - } } } \ No newline at end of file diff --git a/FCS.Lib.Azure.csproj b/FCS.Lib.Azure.csproj index 920abb6..975c7c0 100644 --- a/FCS.Lib.Azure.csproj +++ b/FCS.Lib.Azure.csproj @@ -3,6 +3,7 @@ 10.0 + Debug @@ -12,7 +13,7 @@ Properties FCS.Lib.Azure FCS.Lib.Azure - v4.8 + v4.7.2 512 true @@ -38,9 +39,14 @@ + + + + + @@ -62,10 +68,6 @@ {3e5fa1ab-44d2-4cbc-b6d7-80b74ca9b265} FCS.Lib.Common - - {8ccdfbd9-80ca-4ddf-9031-3d5d3fb972c2} - FCS.Contracts - {1f1fecfd-e07e-4b5c-a7f9-67fb89ee94a3} FCS.Lib.Utility diff --git a/IAzureConfigProvider.cs b/IAzureConfigProvider.cs new file mode 100644 index 0000000..5e0a15e --- /dev/null +++ b/IAzureConfigProvider.cs @@ -0,0 +1,33 @@ +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +namespace FCS.Lib.Azure; + +public interface IAzureConfigProvider +{ + AzureConfigStore GetAzureConfigStore(string country); + AzureAuthStore GetAzureAuthStore(); +} \ No newline at end of file diff --git a/IAzureTokenFetcher.cs b/IAzureTokenFetcher.cs new file mode 100644 index 0000000..2335893 --- /dev/null +++ b/IAzureTokenFetcher.cs @@ -0,0 +1,34 @@ +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +using System.Threading.Tasks; + +namespace FCS.Lib.Azure; + +public interface IAzureTokenFetcher +{ + Task FetchAzureToken(); +} \ No newline at end of file diff --git a/IAzureTokenProvider.cs b/IAzureTokenProvider.cs new file mode 100644 index 0000000..13c3900 --- /dev/null +++ b/IAzureTokenProvider.cs @@ -0,0 +1,48 @@ +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 02 13:17 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +using System.Threading.Tasks; + +namespace FCS.Lib.Azure; + +/// +/// Interface IAzureTokenService +/// +public interface IAzureTokenProvider +{ + /// + /// Get access token + /// + /// Access token as async task + Task GetAccessToken(); + + /// + /// Return if token is valid + /// + /// + /// true/false + bool TokenHasExpired(long timestamp); +} \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index a42ae73..4029274 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -1,4 +1,30 @@ -using System.Reflection; +// *********************************************************************** +// Assembly : FCS.Lib.Azure +// Author : +// Created : 2023 10 01 11:03 +// +// Last Modified By : root +// Last Modified On : 2023 10 02 15:24 +// *********************************************************************** +// +// Copyright (C) 2023-2023 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses] +// +// +// *********************************************************************** + +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -32,4 +58,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/app.config b/app.config index 3f90ec0..8598e70 100644 --- a/app.config +++ b/app.config @@ -1,19 +1,19 @@ - + - - + + - - + + - - + + - \ No newline at end of file +