-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
439 additions
and
190 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<ProjectGuid>{7BA8E238-C930-45C0-BB5D-28AE4D89669B}</ProjectGuid> | ||
</PropertyGroup> | ||
|
||
|
||
<ItemGroup> | ||
<PackageReference Include="Altinn.Platform.Models" Version="1.5.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" /> | ||
<PackageReference Include="Scrutor" Version="4.2.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(Configuration)'=='Debug'"> | ||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<AdditionalFiles Include="..\..\stylecop.json"> | ||
<Link>stylecop.json</Link> | ||
</AdditionalFiles> | ||
</ItemGroup> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Altinn.Profile.Core | ||
{ | ||
/// <summary> | ||
/// General configuration settings for the core project | ||
/// </summary> | ||
public class CoreSettings | ||
{ | ||
/// <summary> | ||
/// The number of seconds the user profile will be kept in the cache | ||
/// </summary> | ||
public int ProfileCacheLifetimeSeconds { get; set; } = 600; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Altinn.Profile.Core/Integrations/IUserProfileClient.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Altinn.Platform.Profile.Models; | ||
|
||
namespace Altinn.Profile.Core.Integrations | ||
{ | ||
/// <summary> | ||
/// Interface describing a client for the user profile service | ||
/// </summary> | ||
public interface IUserProfileClient | ||
{ | ||
/// <summary> | ||
/// Method that fetches a user based on a user id | ||
/// </summary> | ||
/// <param name="userId">The user id</param> | ||
/// <returns>User profile with given user id.</returns> | ||
Task<UserProfile> GetUser(int userId); | ||
|
||
/// <summary> | ||
/// Method that fetches a user based on ssn. | ||
/// </summary> | ||
/// <param name="ssn">The user's ssn.</param> | ||
/// <returns>User profile connected to given ssn.</returns> | ||
Task<UserProfile> GetUser(string ssn); | ||
|
||
/// <summary> | ||
/// Method that fetches a user based on a user uuid | ||
/// </summary> | ||
/// <param name="userUuid">The user uuid</param> | ||
/// <returns>User profile with given user uuid.</returns> | ||
Task<UserProfile> GetUserByUuid(Guid userUuid); | ||
|
||
/// <summary> | ||
/// Method that fetches a list of users based on a list of user uuid | ||
/// </summary> | ||
/// <param name="userUuidList">The list of user uuids</param> | ||
/// <returns>List of User profiles with given user uuids</returns> | ||
Task<List<UserProfile>> GetUserListByUuid(List<Guid> userUuidList); | ||
|
||
/// <summary> | ||
/// Method that fetches a user based on username. | ||
/// </summary> | ||
/// <param name="username">The user's username.</param> | ||
/// <returns>User profile connected to given username.</returns> | ||
Task<UserProfile> GetUserByUsername(string username); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Altinn.Profile.Core; | ||
using Altinn.Profile.Core.User; | ||
|
||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Altinn.Notifications.Core.Extensions; | ||
|
||
/// <summary> | ||
/// Extension class for <see cref="IServiceCollection"/> | ||
/// </summary> | ||
public static class ServiceCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Adds core services and configurations to DI container. | ||
/// </summary> | ||
/// <param name="services">service collection.</param> | ||
/// <param name="config">the configuration collection</param> | ||
public static void AddCoreServices(this IServiceCollection services, IConfiguration config) | ||
{ | ||
services | ||
.Configure<CoreSettings>(config.GetSection(nameof(CoreSettings))) | ||
.AddMemoryCache() | ||
.AddSingleton<IUserProfileService, UserProfileService>() | ||
.Decorate<IUserProfileService, UserProfileCachingDecorator>(); | ||
} | ||
} |
7 changes: 1 addition & 6 deletions
7
...Services/Interfaces/IUserContactPoints.cs → .../User.ContactPoints/IUserContactPoints.cs
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
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
2 changes: 1 addition & 1 deletion
2
....Profile/Models/UserContactPointLookup.cs → ...r.ContactPoints/UserContactPointLookup.cs
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
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
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
12 changes: 4 additions & 8 deletions
12
...file/Services/Interfaces/IUserProfiles.cs → ....Profile.Core/User/IUserProfileService.cs
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
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
Oops, something went wrong.