File tree Expand file tree Collapse file tree
Codebreaker.Identity.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <TargetFramework >net8.0</TargetFramework >
5+ <ImplicitUsings >enable</ImplicitUsings >
6+ <Nullable >enable</Nullable >
7+
8+ <IsPackable >false</IsPackable >
9+ <IsTestProject >true</IsTestProject >
10+ </PropertyGroup >
11+
12+ <ItemGroup >
13+ <PackageReference Include =" Microsoft.NET.Test.Sdk" />
14+ <PackageReference Include =" xunit" />
15+ <PackageReference Include =" xunit.runner.visualstudio" >
16+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
17+ <PrivateAssets >all</PrivateAssets >
18+ </PackageReference >
19+ <PackageReference Include =" coverlet.collector" >
20+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
21+ <PrivateAssets >all</PrivateAssets >
22+ </PackageReference >
23+ <PackageReference Include =" Moq" />
24+ </ItemGroup >
25+
26+ <ItemGroup >
27+ <ProjectReference Include =" ..\Codebreaker.Identity\Codebreaker.Identity.csproj" />
28+ </ItemGroup >
29+
30+ </Project >
Original file line number Diff line number Diff line change 1+ global using Xunit ;
Original file line number Diff line number Diff line change 1+ namespace Codebreaker . Identity . Tests ;
2+
3+ public class UnitTest1
4+ {
5+ [ Fact ]
6+ public void Test1 ( )
7+ {
8+
9+ }
10+ }
Original file line number Diff line number Diff line change 1+ namespace Codebreaker . Identity ;
2+
3+ public class Class1
4+ {
5+
6+ }
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <TargetFramework >net8.0</TargetFramework >
5+ <ImplicitUsings >enable</ImplicitUsings >
6+ <Nullable >enable</Nullable >
7+ </PropertyGroup >
8+
9+ <ItemGroup >
10+ <PackageReference Include =" Microsoft.Graph" />
11+ <PackageReference Include =" Microsoft.Extensions.Options" />
12+ <PackageReference Include =" Microsoft.Extensions.DependencyInjection.Abstractions" />
13+ <PackageReference Include =" Microsoft.Extensions.Logging.Abstractions" />
14+ <PackageReference Include =" Azure.Identity" />
15+ </ItemGroup >
16+
17+ </Project >
Original file line number Diff line number Diff line change 1+ namespace Codebreaker . Identity . Configuration ;
2+
3+ /// <summary>
4+ /// Configuration options for anonymous users
5+ /// </summary>
6+ public class AnonymousUserOptions
7+ {
8+ /// <summary>
9+ /// Gets or sets the tenant ID for the Azure AD tenant
10+ /// </summary>
11+ public string TenantId { get ; set ; } = string . Empty ;
12+
13+ /// <summary>
14+ /// Gets or sets the client ID for the Azure AD application used for graph operations
15+ /// </summary>
16+ public string ClientId { get ; set ; } = string . Empty ;
17+
18+ /// <summary>
19+ /// Gets or sets the client secret for the Azure AD application
20+ /// </summary>
21+ public string ClientSecret { get ; set ; } = string . Empty ;
22+
23+ /// <summary>
24+ /// Gets or sets the domain for anonymous users
25+ /// </summary>
26+ public string Domain { get ; set ; } = string . Empty ;
27+
28+ /// <summary>
29+ /// Gets or sets the password policy for anonymous users
30+ /// </summary>
31+ public string PasswordPolicy { get ; set ; } = string . Empty ;
32+
33+ /// <summary>
34+ /// Gets or sets the password length for anonymous users
35+ /// </summary>
36+ public int PasswordLength { get ; set ; } = 12 ;
37+
38+ /// <summary>
39+ /// Gets or sets the user name prefix for anonymous users
40+ /// </summary>
41+ public string UserNamePrefix { get ; set ; } = "anon" ;
42+ }
Original file line number Diff line number Diff line change 1+ using Codebreaker . Identity . Configuration ;
2+ using Codebreaker . Identity . Services ;
3+ using Microsoft . Extensions . DependencyInjection ;
4+
5+ namespace Codebreaker . Identity . Extensions ;
6+
7+ /// <summary>
8+ /// Extension methods to configure Codebreaker.Identity services
9+ /// </summary>
10+ public static class ServiceCollectionExtensions
11+ {
12+ /// <summary>
13+ /// Adds the anonymous user service to the service collection
14+ /// </summary>
15+ /// <param name="services">The service collection</param>
16+ /// <returns>The service collection</returns>
17+ public static IServiceCollection AddAnonymousUserService ( this IServiceCollection services )
18+ {
19+ services . AddScoped < IAnonymousUserService , GraphAnonymousUserService > ( ) ;
20+ return services ;
21+ }
22+
23+ /// <summary>
24+ /// Adds the anonymous user service to the service collection with configuration
25+ /// </summary>
26+ /// <param name="services">The service collection</param>
27+ /// <param name="configureOptions">The configuration action</param>
28+ /// <returns>The service collection</returns>
29+ public static IServiceCollection AddAnonymousUserService (
30+ this IServiceCollection services ,
31+ Action < AnonymousUserOptions > configureOptions )
32+ {
33+ services . Configure ( configureOptions ) ;
34+ services . AddScoped < IAnonymousUserService , GraphAnonymousUserService > ( ) ;
35+ return services ;
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ namespace Codebreaker . Identity . Models ;
2+
3+ /// <summary>
4+ /// Represents an anonymous user with access credentials
5+ /// </summary>
6+ public class AnonymousUser
7+ {
8+ /// <summary>
9+ /// Gets or sets the user's unique identifier
10+ /// </summary>
11+ public string Id { get ; set ; } = string . Empty ;
12+
13+ /// <summary>
14+ /// Gets or sets the user name
15+ /// </summary>
16+ public string UserName { get ; set ; } = string . Empty ;
17+
18+ /// <summary>
19+ /// Gets or sets the display name
20+ /// </summary>
21+ public string DisplayName { get ; set ; } = string . Empty ;
22+
23+ /// <summary>
24+ /// Gets or sets the email address
25+ /// </summary>
26+ public string Email { get ; set ; } = string . Empty ;
27+
28+ /// <summary>
29+ /// Gets or sets the password
30+ /// </summary>
31+ public string Password { get ; set ; } = string . Empty ;
32+
33+ /// <summary>
34+ /// Gets or sets the creation date
35+ /// </summary>
36+ public DateTimeOffset CreatedAt { get ; set ; } = DateTimeOffset . UtcNow ;
37+
38+ /// <summary>
39+ /// Gets or sets the last login date
40+ /// </summary>
41+ public DateTimeOffset ? LastLoginAt { get ; set ; }
42+ }
You can’t perform that action at this time.
0 commit comments