< Summary - Syki

Information
Class: Syki.Back.Domain.Identity.SsoConfiguration
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Domain/Identity/SsoConfiguration.cs
Tag: 97_27801654829
Line coverage
0%
Covered lines: 0
Uncovered lines: 42
Coverable lines: 42
Total lines: 71
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
 1namespace Syki.Back.Domain.Identity;
 2
 3/// <summary>
 4/// SSO configuration for an institution.
 5/// </summary>
 6public class SsoConfiguration
 7{
 08    public int Id { get; set; }
 09    public Guid PublicId { get; set; }
 010    public int InstitutionId { get; set; }
 11
 12    // Provider
 013    public SsoProviderType ProviderType { get; set; }
 014    public string Authority { get; set; }
 015    public string ClientId { get; set; }
 016    public string ClientSecret { get; set; }
 17
 18    // Domains
 019    public List<SsoAllowedDomain> AllowedDomains { get; set; }
 20
 21    // Behavior
 022    public bool IsActive { get; set; }
 023    public bool RequireSso { get; set; }
 24
 25    // Metadata
 026    public DateTime CreatedAt { get; set; }
 027    public DateTime UpdatedAt { get; set; }
 28
 029    public SsoConfiguration() { }
 30
 031    public SsoConfiguration(
 032        int orgId,
 033        SsoProviderType providerType,
 034        string authority,
 035        string clientId,
 036        string clientSecret,
 037        List<string> allowedDomains)
 38    {
 039        InstitutionId = orgId;
 040        PublicId = Guid.NewGuid();
 041        ProviderType = providerType;
 042        Authority = authority;
 043        ClientId = clientId;
 044        ClientSecret = clientSecret;
 045        IsActive = true;
 046        RequireSso = false;
 047        CreatedAt = DateTime.UtcNow;
 048        UpdatedAt = CreatedAt;
 49
 050        AllowedDomains = allowedDomains
 051            .Select(d => new SsoAllowedDomain(d))
 052            .ToList();
 053    }
 54
 55    public void Update(
 56        SsoProviderType providerType,
 57        string authority,
 58        string clientId,
 59        string clientSecret,
 60        bool isActive,
 61        bool requireSso)
 62    {
 063        ProviderType = providerType;
 064        Authority = authority;
 065        ClientId = clientId;
 066        ClientSecret = clientSecret;
 067        IsActive = isActive;
 068        RequireSso = requireSso;
 069        UpdatedAt = DateTime.UtcNow;
 070    }
 71}