Skip to content

Commit

Permalink
Refinement and reorganization of components.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcelhanon committed Feb 14, 2024
1 parent d6002ab commit 1ee4142
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
// Licensed to the Ed-Fi Alliance under one or more agreements.
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.

namespace EdFi.Ods.Features.IdentityManagement.Models;

/// <summary>
/// Defines an interface that closes the generic types of the <see cref="IIdentityService{TCreateRequest,TSearchRequest,TSearchResponse,TIdentityResponse}" />
/// with the default Identities request/response models.
/// </summary>
public interface IIdentityServiceWithDefaultModels
: IIdentityService<IdentityCreateRequest, IdentitySearchRequest, IdentitySearchResponse<IdentityResponse>,
IdentityResponse> { };
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
// Licensed to the Ed-Fi Alliance under one or more agreements.
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.

namespace EdFi.Ods.Features.IdentityManagement.Models;

/// <summary>
/// Defines an interface that closes the generic types of the <see cref="IIdentityServiceAsync{TSearchRequest,TSearchResponse,TIdentityResponse}" />
/// with the default Identities request/response models.
/// </summary>
public interface IIdentityServiceWithDefaultModelsAsync
: IIdentityServiceAsync<IdentitySearchRequest, IdentitySearchResponse<IdentityResponse>, IdentityResponse> { };
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: Apache-2.0
// Licensed to the Ed-Fi Alliance under one or more agreements.
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.

using EdFi.Ods.Features.Controllers;
using EdFi.Ods.Features.IdentityManagement.Models;

namespace EdFi.Ods.Features.IdentityManagement;

/// <summary>
/// Closes the Identities base controller around the default request/response model types to enable ASP.NET to find
/// and instantiate it.
/// </summary>
/// <remarks>You can extend the default Identities request/response models by registering replacement services
/// with different (derived) model types, and then providing a new controller that derives from the <see cref="IdentitiesControllerBase{TCreateRequest,TSearchRequest,TSearchResponse,TIdentityResponse}"/>
/// class and closes the generic type definition so that ASP.NET will locate and instantiate it (instead of the
/// out-of-the-box <see cref="IdentitiesController" />.
/// </remarks>
public class IdentitiesController
: IdentitiesControllerBase<IdentityCreateRequest, IdentitySearchRequest, IdentitySearchResponse<IdentityResponse>,
IdentityResponse>
{
public IdentitiesController(
IIdentityServiceWithDefaultModels identitySubsystem,
IIdentityServiceWithDefaultModelsAsync identitySubsystemAsync)
: base(identitySubsystem, identitySubsystemAsync) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace EdFi.Ods.Features.IdentityManagement;

/// <summary>
/// Implements a convention that looks for multiple controllers derived from the abstract <see cref="IdentitiesControllerBase{TCreateRequest, TSearchRequest, TSearchResponse, TIdentityResponse}" />
/// base controller class, and removes the <see cref="ControllerModel" /> entry for the default out-of-the-box <see cref="UnimplementedIdentitiesController" />
/// to prevent <see cref="AmbiguousMatchException" /> from occurring when resolving requests for identity management.
/// base controller class, and removes the <see cref="ControllerModel" /> entry for the default out-of-the-box <see cref="IdentitiesController" />
/// to prevent <see cref="AmbiguousMatchException" /> from occurring when resolving requests for identity management routes.
/// </summary>
public class IdentitiesControllerOverrideConvention : IApplicationModelConvention
{
Expand Down Expand Up @@ -47,7 +47,7 @@ public void Apply(ApplicationModel application)
{
foreach (var controllerModel in identitiesControllers)
{
if (controllerModel.ControllerType == typeof(UnimplementedIdentitiesController).GetTypeInfo())
if (controllerModel.ControllerType == typeof(IdentitiesController).GetTypeInfo())
{
application.Controllers.Remove(controllerModel);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@

namespace EdFi.Ods.Features.IdentityManagement
{
// Define new interface that closes the generic types for easier use
public interface IUnimplementedIdentityService
: IIdentityService<IdentityCreateRequest, IdentitySearchRequest, IdentitySearchResponse<IdentityResponse>,
IdentityResponse> {};

// Define new interface that closes the generic types for easier use
public interface IUnimplementedIdentityServiceAsync
: IIdentityServiceAsync<IdentitySearchRequest, IdentitySearchResponse<IdentityResponse>, IdentityResponse> {};

public class UnimplementedIdentityService : IUnimplementedIdentityService, IUnimplementedIdentityServiceAsync
/// <summary>
/// Implements the Identities service such that it exhibits no capabilities and each method throws <see cref="NotImplementedException" />.
/// </summary>
public class UnimplementedIdentityService : IIdentityServiceWithDefaultModels, IIdentityServiceWithDefaultModelsAsync
{
public IdentityServiceCapabilities IdentityServiceCapabilities
{
Expand Down

0 comments on commit 1ee4142

Please sign in to comment.