Esempio n. 1
0
 public SsoConfigDataViewModel(SsoConfigurationData configurationData, GlobalSettings globalSettings,
                               Guid organizationId)
 {
     ConfigType                       = configurationData.ConfigType;
     Authority                        = configurationData.Authority;
     ClientId                         = configurationData.ClientId;
     ClientSecret                     = configurationData.ClientSecret;
     CallbackPath                     = configurationData.BuildCallbackPath(globalSettings.BaseServiceUri.Sso);
     SignedOutCallbackPath            = configurationData.BuildSignedOutCallbackPath(globalSettings.BaseServiceUri.Sso);
     MetadataAddress                  = configurationData.MetadataAddress;
     RedirectBehavior                 = configurationData.RedirectBehavior;
     GetClaimsFromUserInfoEndpoint    = configurationData.GetClaimsFromUserInfoEndpoint;
     SpEntityId                       = configurationData.BuildSaml2ModulePath(globalSettings.BaseServiceUri.Sso);
     SpAcsUrl                         = configurationData.BuildSaml2AcsUrl(globalSettings.BaseServiceUri.Sso, organizationId.ToString());
     IdpEntityId                      = configurationData.IdpEntityId;
     IdpBindingType                   = configurationData.IdpBindingType;
     IdpSingleSignOnServiceUrl        = configurationData.IdpSingleSignOnServiceUrl;
     IdpSingleLogoutServiceUrl        = configurationData.IdpSingleLogoutServiceUrl;
     IdpArtifactResolutionServiceUrl  = configurationData.IdpArtifactResolutionServiceUrl;
     IdpX509PublicCert                = configurationData.IdpX509PublicCert;
     IdpOutboundSigningAlgorithm      = configurationData.IdpOutboundSigningAlgorithm;
     IdpAllowUnsolicitedAuthnResponse = configurationData.IdpAllowUnsolicitedAuthnResponse;
     IdpDisableOutboundLogoutRequests = configurationData.IdpDisableOutboundLogoutRequests;
     IdpWantAuthnRequestsSigned       = configurationData.IdpWantAuthnRequestsSigned;
     SpNameIdFormat                   = configurationData.SpNameIdFormat;
     SpOutboundSigningAlgorithm       = configurationData.SpOutboundSigningAlgorithm ?? SamlSigningAlgorithms.Sha256;
     SpSigningBehavior                = configurationData.SpSigningBehavior;
     SpWantAssertionsSigned           = configurationData.SpWantAssertionsSigned;
     SpValidateCertificates           = configurationData.SpValidateCertificates;
 }
Esempio n. 2
0
        public SsoConfigEditViewModel(SsoConfig ssoConfig, II18nService i18nService,
                                      GlobalSettings globalSettings)
        {
            if (ssoConfig != null)
            {
                Id      = ssoConfig.Id;
                Enabled = ssoConfig.Enabled;
            }

            SsoConfigurationData configurationData;

            if (!string.IsNullOrWhiteSpace(ssoConfig?.Data))
            {
                var options = new JsonSerializerOptions
                {
                    PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                };
                configurationData = JsonSerializer.Deserialize <SsoConfigurationData>(ssoConfig.Data, options);
            }
            else
            {
                configurationData = new SsoConfigurationData();
            }

            Data = new SsoConfigDataViewModel(configurationData, globalSettings);
            BuildLists(i18nService);
        }
Esempio n. 3
0
 public SsoConfigurationDataRequest(SsoConfigurationData configurationData)
 {
     ConfigType       = configurationData.ConfigType;
     Authority        = configurationData.Authority;
     ClientId         = configurationData.ClientId;
     ClientSecret     = configurationData.ClientSecret;
     MetadataAddress  = configurationData.MetadataAddress;
     RedirectBehavior = configurationData.RedirectBehavior;
     GetClaimsFromUserInfoEndpoint = configurationData.GetClaimsFromUserInfoEndpoint;
     IdpEntityId                      = configurationData.IdpEntityId;
     IdpBindingType                   = configurationData.IdpBindingType;
     IdpSingleSignOnServiceUrl        = configurationData.IdpSingleSignOnServiceUrl;
     IdpSingleLogoutServiceUrl        = configurationData.IdpSingleLogoutServiceUrl;
     IdpArtifactResolutionServiceUrl  = configurationData.IdpArtifactResolutionServiceUrl;
     IdpX509PublicCert                = configurationData.IdpX509PublicCert;
     IdpOutboundSigningAlgorithm      = configurationData.IdpOutboundSigningAlgorithm;
     IdpAllowUnsolicitedAuthnResponse = configurationData.IdpAllowUnsolicitedAuthnResponse;
     IdpDisableOutboundLogoutRequests = configurationData.IdpDisableOutboundLogoutRequests;
     IdpWantAuthnRequestsSigned       = configurationData.IdpWantAuthnRequestsSigned;
     SpNameIdFormat                   = configurationData.SpNameIdFormat;
     SpOutboundSigningAlgorithm       = configurationData.SpOutboundSigningAlgorithm ?? SamlSigningAlgorithms.Sha256;
     SpSigningBehavior                = configurationData.SpSigningBehavior;
     SpWantAssertionsSigned           = configurationData.SpWantAssertionsSigned;
     SpValidateCertificates           = configurationData.SpValidateCertificates;
     SpMinIncomingSigningAlgorithm    = configurationData.SpMinIncomingSigningAlgorithm ?? SamlSigningAlgorithms.Sha256;
     AdditionalScopes                 = configurationData.AdditionalScopes;
     AdditionalUserIdClaimTypes       = configurationData.AdditionalUserIdClaimTypes;
     AdditionalEmailClaimTypes        = configurationData.AdditionalEmailClaimTypes;
     AdditionalNameClaimTypes         = configurationData.AdditionalNameClaimTypes;
     AcrValues = configurationData.AcrValues;
     ExpectedReturnAcrValue = configurationData.ExpectedReturnAcrValue;
 }
 public SsoUrls(string organizationId, GlobalSettings globalSettings)
 {
     CallbackPath          = SsoConfigurationData.BuildCallbackPath(globalSettings.BaseServiceUri.Sso);
     SignedOutCallbackPath = SsoConfigurationData.BuildSignedOutCallbackPath(globalSettings.BaseServiceUri.Sso);
     SpEntityId            = SsoConfigurationData.BuildSaml2ModulePath(globalSettings.BaseServiceUri.Sso);
     SpMetadataUrl         = SsoConfigurationData.BuildSaml2MetadataUrl(globalSettings.BaseServiceUri.Sso, organizationId);
     SpAcsUrl = SsoConfigurationData.BuildSaml2AcsUrl(globalSettings.BaseServiceUri.Sso, organizationId);
 }
        public OrganizationSsoResponseModel(Organization organization, GlobalSettings globalSettings,
                                            SsoConfig config = null) : base("organizationSso")
        {
            if (config != null)
            {
                Enabled = config.Enabled;
                Data    = config.GetData();
            }
            else
            {
                Data = new SsoConfigurationData();
            }

            Urls = new SsoUrls(organization.Id.ToString(), Data, globalSettings);
        }
Esempio n. 6
0
        public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization) : this("profileOrganization")
        {
            Id                            = organization.OrganizationId.ToString();
            Name                          = organization.Name;
            UsePolicies                   = organization.UsePolicies;
            UseSso                        = organization.UseSso;
            UseKeyConnector               = organization.UseKeyConnector;
            UseScim                       = organization.UseScim;
            UseGroups                     = organization.UseGroups;
            UseDirectory                  = organization.UseDirectory;
            UseEvents                     = organization.UseEvents;
            UseTotp                       = organization.UseTotp;
            Use2fa                        = organization.Use2fa;
            UseApi                        = organization.UseApi;
            UseResetPassword              = organization.UseResetPassword;
            UsersGetPremium               = organization.UsersGetPremium;
            SelfHost                      = organization.SelfHost;
            Seats                         = organization.Seats;
            MaxCollections                = organization.MaxCollections;
            MaxStorageGb                  = organization.MaxStorageGb;
            Key                           = organization.Key;
            HasPublicAndPrivateKeys       = organization.PublicKey != null && organization.PrivateKey != null;
            Status                        = organization.Status;
            Type                          = organization.Type;
            Enabled                       = organization.Enabled;
            SsoBound                      = !string.IsNullOrWhiteSpace(organization.SsoExternalId);
            Identifier                    = organization.Identifier;
            Permissions                   = CoreHelpers.LoadClassFromJsonData <Permissions>(organization.Permissions);
            ResetPasswordEnrolled         = organization.ResetPasswordKey != null;
            UserId                        = organization.UserId?.ToString();
            ProviderId                    = organization.ProviderId?.ToString();
            ProviderName                  = organization.ProviderName;
            FamilySponsorshipFriendlyName = organization.FamilySponsorshipFriendlyName;
            FamilySponsorshipAvailable    = FamilySponsorshipFriendlyName == null &&
                                            StaticStore.GetSponsoredPlan(PlanSponsorshipType.FamiliesForEnterprise)
                                            .UsersCanSponsor(organization);
            PlanProductType = StaticStore.GetPlan(organization.PlanType).Product;
            FamilySponsorshipLastSyncDate = organization.FamilySponsorshipLastSyncDate;
            FamilySponsorshipToDelete     = organization.FamilySponsorshipToDelete;
            FamilySponsorshipValidUntil   = organization.FamilySponsorshipValidUntil;

            if (organization.SsoConfig != null)
            {
                var ssoConfigData = SsoConfigurationData.Deserialize(organization.SsoConfig);
                KeyConnectorEnabled = ssoConfigData.KeyConnectorEnabled && !string.IsNullOrEmpty(ssoConfigData.KeyConnectorUrl);
                KeyConnectorUrl     = ssoConfigData.KeyConnectorUrl;
            }
        }
Esempio n. 7
0
        public OrganizationSsoResponseModel(Organization organization, GlobalSettings globalSettings,
                                            SsoConfig config = null) : base("organizationSso")
        {
            if (config != null)
            {
                Enabled = config.Enabled;
                Data    = JsonSerializer.Deserialize <SsoConfigurationData>(config.Data, new JsonSerializerOptions
                {
                    PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                });
            }
            else
            {
                Data = new SsoConfigurationData();
            }

            Urls = new SsoUrls(organization.Id.ToString(), Data, globalSettings);
        }
Esempio n. 8
0
 public void SetData(SsoConfigurationData data)
 {
     Data = data.Serialize();
 }
Esempio n. 9
0
 public SsoConfigurationData GetData()
 {
     return(SsoConfigurationData.Deserialize(Data));
 }