Compare commits
	
		
			2 Commits
		
	
	
		
			main
			...
			feature/ad
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | b90bb23f27 | ||
|   | f694b9a41a | 
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="ErrorDetailsDto.cs"> | // <copyright file="ErrorDetailsDto.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="HttpErrorDto.cs"> | // <copyright file="HttpErrorDto.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="HttpException.cs"> | // <copyright file="HttpException.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="LogDetail.cs"> | // <copyright file="LogDetail.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="LogOperation.cs"> | // <copyright file="LogOperation.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="LogSeverity.cs"> | // <copyright file="LogSeverity.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="LogTarget.cs"> | // <copyright file="LogTarget.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="ServiceSettings.cs"> | // <copyright file="ServiceSettings.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="Claims.cs"> | // <copyright file="Claims.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| namespace Core.Blueprint.Logging | namespace Core.Blueprint.Logging | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="DisplayNames.cs"> | // <copyright file="DisplayNames.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="EnvironmentVariables.cs"> | // <copyright file="EnvironmentVariables.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="ErrorCodes.cs"> | // <copyright file="ErrorCodes.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="MimeTypes.cs"> | // <copyright file="MimeTypes.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="Responses.cs"> | // <copyright file="Responses.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="HttpErrorMiddleware.cs"> | // <copyright file="HttpErrorMiddleware.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="HttpLogger.cs"> | // <copyright file="HttpLogger.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="HttpLoggingMiddleware.cs"> | // <copyright file="HttpLoggingMiddleware.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,10 +5,10 @@ using MongoDB.Driver.Authentication.Oidc; | |||||||
| namespace Core.Blueprint.Mongo.Configuration | namespace Core.Blueprint.Mongo.Configuration | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// The <see cref="HeathIdentityProvider"/> class is responsible for acquiring an OpenID Connect (OIDC)  |     /// The <see cref="AzureIdentityProvider"/> class is responsible for acquiring an OpenID Connect (OIDC)  | ||||||
|     /// access token for MongoDB authentication using Azure Identity and Managed Identity credentials. |     /// access token for MongoDB authentication using Azure Identity and Managed Identity credentials. | ||||||
|     /// </summary> |     /// </summary> | ||||||
|     public class HeathIdentityProvider : IOidcCallback |     public class AzureIdentityProvider : IOidcCallback | ||||||
|     { |     { | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// The audience (resource identifier) for which the OIDC token is being requested. |         /// The audience (resource identifier) for which the OIDC token is being requested. | ||||||
| @@ -21,10 +21,10 @@ namespace Core.Blueprint.Mongo.Configuration | |||||||
|         private readonly string _environment; |         private readonly string _environment; | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Initializes a new instance of the <see cref="HeathIdentityProvider"/> class with the specified audience. |         /// Initializes a new instance of the <see cref="AzureIdentityProvider"/> class with the specified audience. | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         /// <param name="audience">The audience (resource identifier) for which the OIDC token is being requested.</param> |         /// <param name="audience">The audience (resource identifier) for which the OIDC token is being requested.</param> | ||||||
|         public HeathIdentityProvider(string audience) |         public AzureIdentityProvider(string audience) | ||||||
|         { |         { | ||||||
|             _audience = audience; |             _audience = audience; | ||||||
|             _environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? string.Empty; |             _environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? string.Empty; | ||||||
| @@ -46,7 +46,7 @@ namespace Core.Blueprint.DAL.Mongo.Configuration | |||||||
|             { |             { | ||||||
|                 var settings = serviceProvider.GetRequiredService<IOptions<MongoDbSettings>>().Value; |                 var settings = serviceProvider.GetRequiredService<IOptions<MongoDbSettings>>().Value; | ||||||
|                 var mongoClientSettings = MongoClientSettings.FromConnectionString(settings.ConnectionString); |                 var mongoClientSettings = MongoClientSettings.FromConnectionString(settings.ConnectionString); | ||||||
|                 mongoClientSettings.Credential = MongoCredential.CreateOidcCredential(new HeathIdentityProvider(settings.Audience)); |                 mongoClientSettings.Credential = MongoCredential.CreateOidcCredential(new AzureIdentityProvider(settings.Audience)); | ||||||
|                 return new MongoClient(mongoClientSettings); |                 return new MongoClient(mongoClientSettings); | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -148,5 +148,13 @@ namespace Core.Blueprint.Mongo | |||||||
|         /// <param name="filterExpression">An expression used to filter the documents to delete.</param> |         /// <param name="filterExpression">An expression used to filter the documents to delete.</param> | ||||||
|         /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |         /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> | ||||||
|         Task DeleteManyAsync(Expression<Func<TDocument, bool>> filterExpression); |         Task DeleteManyAsync(Expression<Func<TDocument, bool>> filterExpression); | ||||||
|  |  | ||||||
|  |         /// <summary> | ||||||
|  |         /// Executes an aggregation pipeline and returns the first document in the result asynchronously. | ||||||
|  |         /// </summary> | ||||||
|  |         /// <typeparam name="TOutput">The type of the output document you expect from the pipeline.</typeparam> | ||||||
|  |         /// <param name="pipeline">The aggregation pipeline definition to execute.</param> | ||||||
|  |         /// <returns>The first document from the aggregation result, or null if none found.</returns> | ||||||
|  |         Task<TOutput> FindOnePipelineAsync<TOutput>(PipelineDefinition<TDocument, TOutput> pipeline); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -248,5 +248,16 @@ namespace Core.Blueprint.Mongo | |||||||
|         { |         { | ||||||
|             return Task.Run(() => _collection.DeleteManyAsync(filterExpression)); |             return Task.Run(() => _collection.DeleteManyAsync(filterExpression)); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         /// <summary> | ||||||
|  |         /// Executes an aggregation pipeline and returns the first document in the result asynchronously. | ||||||
|  |         /// </summary> | ||||||
|  |         /// <typeparam name="TOutput">The type of the output document you expect from the pipeline.</typeparam> | ||||||
|  |         /// <param name="pipeline">The aggregation pipeline definition to execute.</param> | ||||||
|  |         /// <returns>The first document from the aggregation result, or null if none found.</returns> | ||||||
|  |         public virtual Task<TOutput> FindOnePipelineAsync<TOutput>(PipelineDefinition<TDocument, TOutput> pipeline) | ||||||
|  |         { | ||||||
|  |             return Task.Run(() => _collection.Aggregate(pipeline).FirstOrDefaultAsync()); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user