< Summary - Syki

Information
Class: Syki.Back.Domain.Identity.SsoConfiguration
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Domain/Identity/SsoConfiguration.cs
Tag: 56_26538939494
Line coverage
0%
Covered lines: 0
Uncovered lines: 42
Coverable lines: 42
Total lines: 73
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%210%
get_PublicId()100%210%
get_InstitutionId()100%210%
get_ProviderType()100%210%
get_Authority()100%210%
get_ClientId()100%210%
get_ClientSecret()100%210%
get_AllowedDomains()100%210%
get_IsActive()100%210%
get_RequireSso()100%210%
get_CreatedAt()100%210%
get_UpdatedAt()100%210%
.ctor()100%210%
.ctor(...)100%210%
Update(...)100%210%

File(s)

/home/runner/work/syki/syki/Back/Domain/Identity/SsoConfiguration.cs

#LineLine coverage
 1using Syki.Back.Domain.Enums;
 2
 3namespace Syki.Back.Domain.Identity;
 4
 5/// <summary>
 6/// SSO configuration for an institution.
 7/// </summary>
 8public class SsoConfiguration
 9{
 010    public int Id { get; set; }
 011    public Guid PublicId { get; set; }
 012    public int InstitutionId { get; set; }
 13
 14    // Provider
 015    public SsoProviderType ProviderType { get; set; }
 016    public string Authority { get; set; }
 017    public string ClientId { get; set; }
 018    public string ClientSecret { get; set; }
 19
 20    // Domains
 021    public List<SsoAllowedDomain> AllowedDomains { get; set; }
 22
 23    // Behavior
 024    public bool IsActive { get; set; }
 025    public bool RequireSso { get; set; }
 26
 27    // Metadata
 028    public DateTime CreatedAt { get; set; }
 029    public DateTime UpdatedAt { get; set; }
 30
 031    public SsoConfiguration() { }
 32
 033    public SsoConfiguration(
 034        int orgId,
 035        SsoProviderType providerType,
 036        string authority,
 037        string clientId,
 038        string clientSecret,
 039        List<string> allowedDomains)
 40    {
 041        InstitutionId = orgId;
 042        PublicId = Guid.NewGuid();
 043        ProviderType = providerType;
 044        Authority = authority;
 045        ClientId = clientId;
 046        ClientSecret = clientSecret;
 047        IsActive = true;
 048        RequireSso = false;
 049        CreatedAt = DateTime.UtcNow;
 050        UpdatedAt = CreatedAt;
 51
 052        AllowedDomains = allowedDomains
 053            .Select(d => new SsoAllowedDomain(d))
 054            .ToList();
 055    }
 56
 57    public void Update(
 58        SsoProviderType providerType,
 59        string authority,
 60        string clientId,
 61        string clientSecret,
 62        bool isActive,
 63        bool requireSso)
 64    {
 065        ProviderType = providerType;
 066        Authority = authority;
 067        ClientId = clientId;
 068        ClientSecret = clientSecret;
 069        IsActive = isActive;
 070        RequireSso = requireSso;
 071        UpdatedAt = DateTime.UtcNow;
 072    }
 73}